EXC_BAD_ACCES puchviewcontroller 表视图
我在为 ios5 编译项目时遇到问题。下面的代码适用于ios4.3。在运行时,内核在这一行抛出 EXC_BAD_ACCESS Mach 异常:
[[self navigationController] pushViewController:choixQuotidienTableViewController animated:YES];
In didSelectRowAtIndexPath on my tableview :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
// requête avec la langue choisie
NSArray *codes = [arrayLangages valueForKey:@"code"];
NSString *codeSelect = [codes objectAtIndex:indexPath.row];
//NSLog(@"selected code : %@", codeSelect);
// init table view Choix Quotidien
ChoixQuotidienTableViewController *choixQuotidienTableViewController = [[ChoixQuotidienTableViewController alloc] initWithStyle:UITableViewStylePlain andCode:codeSelect];
//choixQuotidienTableViewController.fromLangue = resultsArrayKioskLangue;
if([self navigationController] == nil)
{
NSLog(@"navigationController IS NIL!!!");
}
else
{
NSLog(@"Nav controller IS OK!");
if(!choixQuotidienTableViewController)
{
NSLog(@"choixcontroller IS NIL!!!");
}
else
{
NSLog(@"choix controller IS OK!");
[[self navigationController] pushViewController:choixQuotidienTableViewController animated:YES];
}
}
choixQuotidienTableViewController = nil;
}
Could you please helpl me ? ios5有什么变化吗?
谢谢 !
更新:好的,新的东西......:我已经使用了 profile >僵尸。这个工具向我显示了 [ChoixQuotidienTableViewController tableView:cellForRowAtIndexPath:] 中的错误...疯狂!
我使用了自定义单元...当我纠正它时它起作用了...
感谢您的帮助!
I have got a problem when I compile my project for ios5. This code below works on ios4.3. During runtime, the Kernel throws a EXC_BAD_ACCESS Mach exception on this line :
[[self navigationController] pushViewController:choixQuotidienTableViewController animated:YES];
In didSelectRowAtIndexPath on my tableview :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
// requête avec la langue choisie
NSArray *codes = [arrayLangages valueForKey:@"code"];
NSString *codeSelect = [codes objectAtIndex:indexPath.row];
//NSLog(@"selected code : %@", codeSelect);
// init table view Choix Quotidien
ChoixQuotidienTableViewController *choixQuotidienTableViewController = [[ChoixQuotidienTableViewController alloc] initWithStyle:UITableViewStylePlain andCode:codeSelect];
//choixQuotidienTableViewController.fromLangue = resultsArrayKioskLangue;
if([self navigationController] == nil)
{
NSLog(@"navigationController IS NIL!!!");
}
else
{
NSLog(@"Nav controller IS OK!");
if(!choixQuotidienTableViewController)
{
NSLog(@"choixcontroller IS NIL!!!");
}
else
{
NSLog(@"choix controller IS OK!");
[[self navigationController] pushViewController:choixQuotidienTableViewController animated:YES];
}
}
choixQuotidienTableViewController = nil;
}
Could you please helpl me ? is something change in ios5 ?
Thanks !
UPDATE : OK something new ... : I've used profil > Zombies. This tools showed me an error in [ChoixQuotidienTableViewController tableView:cellForRowAtIndexPath:] ... CRAZY !
I used a custom cell ... when I corrige this it works ...
Thanks for your help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有更多代码,就很难说。
BAD_ACCESS 不是由此代码产生的。但请注意,如果您不释放
choixQuotidienTableViewController
,它将会泄漏(除非您使用ARC)。确保
[self navigationController]
返回尚未释放的有效对象。调试器堆栈跟踪也可能有所帮助。
It's a bit hard to say without more code.
The BAD_ACCESS is not produced by this code. But be aware that
choixQuotidienTableViewController
will be leaking if you don't release it (except if you use ARC).Ensure that
[self navigationController]
returns a valid object that has not been released.Also the debugger stack trace might help.
你尝试过吗
[choixQuotidienTableViewController 版本];
而不是
choixQuotidienTableViewController = nil;
?Have you try
[choixQuotidienTableViewController release];
instead of
choixQuotidienTableViewController = nil;
?