Reputation: 509
I've received two crash reports on Crashlytics, with similar logs, one for an UIAlertView
and one for 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
I'm using ARC and in my code I alloc/init alert views and action sheets in view controllers setting delegates to self
. I can't find the source of the problem, any suggestions?
This is an example in 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];
end the I implement (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
Upvotes: 2
Views: 1401
Reputation:
You can debug to see at which statement the exception occurs
Click on 'show breakpoint navigator' on left side panel
Click + button on down of panel
Add exception breakpoint
Done pop up
Now it will shows exception statement
Upvotes: 0
Reputation: 7373
The Finest way to find this kind of bug Use the NSZombieEnabled
environment variable.cause of EXC_BAD_ACCESS
is from trying to access released objects.Review this
Upvotes: 2