EXC_BAD_ACCES puchviewcontroller 表视图

发布于 2024-12-11 20:05:43 字数 1714 浏览 3 评论 0原文

我在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无力看清 2024-12-18 20:05:43

如果没有更多代码,就很难说。

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.

月依秋水 2024-12-18 20:05:43

你尝试过吗
[choixQuotidienTableViewController 版本];
而不是
choixQuotidienTableViewController = nil;

Have you try
[choixQuotidienTableViewController release];
instead of
choixQuotidienTableViewController = nil; ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文