1

当我测试我的 iOS 应用程序时,它在某个时候崩溃了。崩溃日志如下,任何人都可以建议我崩溃的原因。以及如何从该崩溃日志数据中轻松了解发生崩溃的位置

Thread 0 Crashed:
0   libobjc.A.dylib                 0x0000000192f881d0 objc_msgSend + 16
1   UIKit                           0x0000000189c7b2c8 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 120
2   UIKit                           0x0000000189c7b1e8 -[_UIModalItemAlertContentView tableView:didSelectRowAtIndexPath:] + 984
3   UIKit                           0x0000000189b6d794 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1260
4   UIKit                           0x0000000189c2e230 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 236
5   UIKit                           0x0000000189ac246c _applyBlockToCFArrayCopiedToStack + 352
6   UIKit                           0x0000000189a2e4a0 _afterCACommitHandler + 500
7   CoreFoundation                  0x0000000186a330a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
8   CoreFoundation                  0x0000000186a3032c __CFRunLoopDoObservers + 368
9   CoreFoundation                  0x0000000186a306b8 __CFRunLoopRun + 760
10  CoreFoundation                  0x00000001869716cc CFRunLoopRunSpecific + 448
11  GraphicsServices                0x000000018c655c08 GSEventRunModal + 164
12  UIKit                           0x0000000189aa2fd8 UIApplicationMain + 1152
13  whirlpool-minerva               0x0000000100047834 0x100024000 + 145460
14  libdyld.dylib                   0x000000019356ba9c start + 0
4

1 回答 1

2

UIAlertView在解除警报之前解除分配的委托。

如果您有一个设置为委托的对象,UIAlertView并且该对象可能在应用程序执行的某个时间点“死亡”(可能在屏幕上显示警报时),那么您必须将警报视图的delegate属性设置为nilin-dealloc方法。您必须保存对已创建警报的引用。

简单的例子:

@property (nonatomic, strong) UIAlertView *alert;
...
self.alert = [[UIAlertView alloc] initWith... delegate:self ...];
[self.alert show];
...
- (void)dealloc {
    self.alert.delegate = nil;
}
于 2014-07-09T11:56:28.917 回答