簡體   English   中英

EXC_BAD_ACCES puchviewcontroller表視圖

[英]EXC_BAD_ACCES puchviewcontroller tableview

當我為ios5編譯項目時遇到問題。 以下代碼可在ios4.3上使用。 在運行時,內核在此行上引發EXC_BAD_ACCESS Mach異常:

[[self navigationController] pushViewController:choixQuotidienTableViewController animated:YES];

在我的tableview的didSelectRowAtIndexPath中:

- (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;
}

你能幫我嗎? ios5有什么變化嗎?

謝謝 !

更新:好的新東西...:我用過profil> Zombies。 該工具向我顯示了[ChoixQuotidienTableViewController tableView:cellForRowAtIndexPath:]中的錯誤……瘋狂!

我使用了一個自定義單元...當我改正它時可以工作...

謝謝你的幫助 !

如果沒有更多代碼,很難說。

該代碼未生成BAD_ACCESS。 但是請注意,如果不釋放choixQuotidienTableViewController它將泄漏(除非使用ARC)。

確保[self navigationController]返回尚未釋放的有效對象。

調試器堆棧跟蹤也可能會有所幫助。

您是否嘗試過[choixQuotidienTableViewController release]; 而不是choixQuotidienTableViewController = nil;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM