我收到了两份关于 Crashlytics 的崩溃报告,其中包含类似的日志,一份用于 an UIAlertView
,一份用于 an UIActionSheet
:
Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0xa0000008
0 libobjc.A.dylib objc_msgSend + 15
1 UIKit -[UIAlertView(Private) _buttonClicked:] + 296
2 UIKit -[UIApplication sendAction:to:from:forEvent:] + 72
3 UIKit -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
4 UIKit -[UIControl sendAction:to:forEvent:] + 44
5 UIKit -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 502
6 UIKit -[UIControl touchesEnded:withEvent:] + 488
7 UIKit -[UIWindow _sendTouchesForEvent:] + 524
8 UIKit -[UIApplication sendEvent:] + 380
9 UIKit _UIApplicationHandleEvent + 6154
10 GraphicsServices _PurpleEventCallback + 590
11 GraphicsServices PurpleEventCallback + 34
12 ... CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
我正在使用 ARC,在我的代码中,我在视图控制器中分配/初始化警报视图和操作表,将委托设置为self
. 我找不到问题的根源,有什么建议吗?
这是一个例子SomeViewController.m
:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you sure?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Continue",nil) destructiveButtonTitle:NSLocalizedString(@"Yes", nil) otherButtonTitles:nil];
actionSheet.delegate = self;
[actionSheet showInView:self.view];
结束我实施(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex