Ios 检测到僵尸-但从未调用该函数
我做了什么? 在我的Ios 检测到僵尸-但从未调用该函数,ios,iphone,objective-c,uitableview,Ios,Iphone,Objective C,Uitableview,我做了什么? 在我的UIViewController子系统中,我实现了UITableView并实现了必要的UITableViewDelegate功能 我面临的是什么? 我面临的问题是,每当我重新启动控制器并点击任何单元格时,我都会在应用程序中获得EXC_BAD_访问权限 我试过什么? 我曾尝试在函数中放置断点,但它从未到达断点。我尝试了全局异常断点,但它也不起作用。我使用仪器进行了检查,发现当调用didDeceloseRowatingIndexPath但控件未到达该函数时,会检测到僵尸 在实施
UIViewController
子系统中,我实现了UITableView
并实现了必要的UITableViewDelegate
功能
我面临的是什么?
我面临的问题是,每当我重新启动控制器并点击任何单元格时,我都会在应用程序中获得EXC_BAD_访问权限
我试过什么?
我曾尝试在函数中放置断点,但它从未到达断点。我尝试了全局异常断点,但它也不起作用。我使用仪器进行了检查,发现当调用didDeceloseRowatingIndexPath
但控件未到达该函数时,会检测到僵尸
在实施评论中给出的建议后,这是我收到的日志
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x023e11e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01fc98e5 objc_exception_throw + 44
2 CoreFoundation 0x02393abc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x02393760 -[__NSArrayM addObject:] + 64
4 UIKit 0x00bf5782 -[UITableViewIndex _displayTitles] + 1071
5 UIKit 0x00bf58a8 -[UITableViewIndex _cacheAndMeasureTitles] + 171
6 UIKit 0x00bf6213 -[UITableViewIndex sizeThatFits:] + 131
7 UIKit 0x00a18bbc -[UITableView _updateIndexFrameSuppressingChangeNotification:] + 513
8 UIKit 0x00a189b6 -[UITableView _updateIndexFrame] + 41
9 UIKit 0x00a19a5f -[UITableView _updateIndex] + 649
10 UIKit 0x00a336f7 -[UITableView layoutSubviews] + 295
11 UIKit 0x009b3964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
12 libobjc.A.dylib 0x01fdb82b -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x002ba45a -[CALayer layoutSublayers] + 148
14 QuartzCore 0x002ae244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x002ae0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
16 QuartzCore 0x002147fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
17 QuartzCore 0x00215b85 _ZN2CA11Transaction6commitEv + 393
18 QuartzCore 0x00216258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19 CoreFoundation 0x023a936e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
20 CoreFoundation 0x023a92bf __CFRunLoopDoObservers + 399
21 CoreFoundation 0x02387254 __CFRunLoopRun + 1076
22 CoreFoundation 0x023869d3 CFRunLoopRunSpecific + 467
23 CoreFoundation 0x023867eb CFRunLoopRunInMode + 123
24 GraphicsServices 0x0381a5ee GSEventRunModal + 192
25 GraphicsServices 0x0381a42b GSEventRun + 104
26 UIKit 0x00944f9b UIApplicationMain + 1225
27 MyApplication 0x00001f9c main + 76
28 libdyld.dylib 0x034b3701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
从所有日志和僵尸图像中可以清楚地看到,您正在访问解除分配的
CountryListViewController
。跟踪CountryListViewController
,并在处理表视图操作时检查它是否可用
更好的选择是,进入Xcode菜单产品->方案->管理方案->编辑(左下)->调试->诊断->检查所有选项->然后运行项目
这将是发现您崩溃的灯塔。在单元格选择上,您试图实现什么?CountryListViewController对象已被释放,您正试图访问此对象,这就是crash的原因。我认为,您已为CountryListViewController创建了一个本地对象,请创建CountryListViewController的类对象,这可能就是原因。我很惊讶没有人在“编辑方案”页面的“诊断”选项卡上提到启用僵尸对象。这通常会为您提供更多有关僵尸对象本身以及它发送的消息的上下文。通过阅读说明,僵尸对象是否可能是tableviews委托?问题是否已解决?