【问题标题】:iOS TableView crash don't know how. Here is the appiOS TableView 崩溃不知道怎么回事。这是应用程序
【发布时间】:2011-01-07 11:48:10
【问题描述】:

在我的应用程序中,您可以在此处下载:http://ge.tt/2DDqfJa

我已经开始讨论但在这里死了iOS TableView crash loading different data

问题是当我从观看 YouTube 视频返回食谱列表时,应用程序崩溃...

当我第二次选择一个类别时,必须在哪里加载具有不同数据源的 tableview,它会崩溃。

这是崩溃日志

节目接收信号:“EXC_BAD_ACCESS”。

(gdb) bt
#0  0x00f0da63 in objc_msgSend ()
#1  0x04b27ca0 in ?? ()
#2  0x00002665 in -[RecipesListController viewWillAppear:] (self=0x4b38a00, _cmd=0x6d81a2, animated=1 '\001') at /Users/claudiocanino/Documents/iOS/CottoMangiato/Classes/RecipesListController.m:67
#3  0x00370c9a in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
#4  0x0036b606 in -[UINavigationController _startDeferredTransitionIfNeeded] ()
#5  0x0037283e in -[UINavigationController pushViewController:transition:forceImmediate:] ()
#6  0x04f49549 in -[UINavigationControllerAccessibility(SafeCategory) pushViewController:transition:forceImmediate:] ()
#7  0x0036b4a0 in -[UINavigationController pushViewController:animated:] ()
#8  0x00003919 in -[CategoryViewController tableView:didSelectRowAtIndexPath:] (self=0x4b27ca0, _cmd=0x6d19e3, tableView=0x500c200, indexPath=0x4b2d650) at /Users/claudiocanino/Documents/iOS/CottoMangiato/Classes/CategoryViewCotroller.m:104
#9  0x0032a794 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] ()
#10 0x00320d50 in -[UITableView _userSelectRowAtPendingSelectionIndexPath:] ()
#11 0x000337f6 in __NSFireDelayedPerform ()
#12 0x00d8cfe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#13 0x00d8e594 in __CFRunLoopDoTimer ()
#14 0x00ceacc9 in __CFRunLoopRun ()
#15 0x00cea240 in CFRunLoopRunSpecific ()
#16 0x00cea161 in CFRunLoopRunInMode ()
#17 0x016e0268 in GSEventRunModal ()
#18 0x016e032d in GSEventRun ()
#19 0x002c342e in UIApplicationMain ()
#20 0x00001c08 in main (argc=1, argv=0xbfffef58) at /Users/claudiocanino/Documents/iOS/CottoMangiato/main.m:15

另一个bt日志:

(gdb) bt
#0  0x00cd76a1 in __CFBasicHashDeallocate ()
#1  0x00cc2bcb in _CFRelease ()
#2  0x00002dd6 in -[RecipesListController setRecipesArray:] (self=0x6834d50, _cmd=0x4293, _value=0x4e3bc70) at /Users/claudiocanino/Documents/iOS/CottoMangiato/Classes/RecipesListController.m:16
#3  0x00002665 in -[RecipesListController viewWillAppear:] (self=0x6834d50, _cmd=0x6d81a2, animated=1 '\001') at /Users/claudiocanino/Documents/iOS/CottoMangiato/Classes/RecipesListController.m:67
#4  0x00370c9a in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
#5  0x0036b606 in -[UINavigationController _startDeferredTransitionIfNeeded] ()
#6  0x0037283e in -[UINavigationController pushViewController:transition:forceImmediate:] ()
#7  0x091ac549 in -[UINavigationControllerAccessibility(SafeCategory) pushViewController:transition:forceImmediate:] ()
#8  0x0036b4a0 in -[UINavigationController pushViewController:animated:] ()
#9  0x00003919 in -[CategoryViewController tableView:didSelectRowAtIndexPath:] (self=0x4b12970, _cmd=0x6d19e3, tableView=0x5014400, indexPath=0x4b2bd00) at /Users/claudiocanino/Documents/iOS/CottoMangiato/Classes/CategoryViewCotroller.m:104
#10 0x0032a794 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] ()
#11 0x00320d50 in -[UITableView _userSelectRowAtPendingSelectionIndexPath:] ()
#12 0x000337f6 in __NSFireDelayedPerform ()
#13 0x00d8cfe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#14 0x00d8e594 in __CFRunLoopDoTimer ()
#15 0x00ceacc9 in __CFRunLoopRun ()
#16 0x00cea240 in CFRunLoopRunSpecific ()
#17 0x00cea161 in CFRunLoopRunInMode ()
#18 0x016e0268 in GSEventRunModal ()
#19 0x016e032d in GSEventRun ()
#20 0x002c342e in UIApplicationMain ()
#21 0x00001c08 in main (argc=1, argv=0xbfffef58) at /Users/claudiocanino/Documents/iOS/CottoMangiato/main.m:15

谢谢

【问题讨论】:

标签: iphone xcode ios crash


【解决方案1】:

您可能试图访问已释放的对象。搜索“NSZombieEnabled”并阅读如何调试过度发布问题。

【讨论】:

  • 感谢您的提示,我已启用僵尸获取更多信息
【解决方案2】:

问题是您过度释放对象。由于您使用的是保留属性,因此在将新对象分配给属性时无需释放该对象。旧对象将自动释放。所以这些行没有意义,删除它们:

if (self.recipesArray != nil) {

    // Release the arrays
    [self.recipesArray release];
    [self.recipesNames release];
}

cellForRowAtIndexPath (RecipesListController) 中,您正在释放 rowString。这里没有必要这样做。删除该行,一切都应该正常工作。

【讨论】:

    【解决方案3】:
    NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
    
    self.recipesArray = dict;
    
    [dict release];
    

    在您的 RecipesListController.m 文件中,检查视图中的 55 行将显示您正在释放您从未给予内存的对象

    当我对 //[self.recipesArray 发布]; //[self.recipesNames 发布]; 然后它在 tableview 行上崩溃检查它

    【讨论】:

    • 它们没用,你说得对。我正在学习,但我不知道为什么。 Tnx
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多