Sanity check: UIBarButtonItem crashes trying to perform action
One of my users is reporting a crash on his device, an iPhone 3GS. Other devices of the same type are not reporting similar behavior. He's sent me a crash log and based on reading it, I'm not sure how to proceed. I hope I'm not interpreting the crash log incorrectly but it doesn't look like my action has been called yet.
This is how I'm creating and setting up the UIBarButtonItem:
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addLog:)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
}
This is the my action method:
- (IBAction)addLog:(id)sender {
MyViewController *myController = [[MyViewController alloc] initWithNibName:@"MyNib" bundle:nil];
UINavigationController *subNavigationController = [[UINavigationController alloc] initWithRootViewController: myController];
[self presentModalViewController:subNavigationController animated:YES];
[myController release];
[subNavigationController release];
}
This is the crash log:
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x0007e98c __kill + 81 libSystem.B.dylib 0x0007e97c kill + 4 2 libSystem.B.dylib 0x0007e96e raise + 10 3 libSystem.B.dylib 0x0009361a abort + 34 4 MyApp 0x000042e8 0x1000 + 13032 5 CoreFoundation 0x00058ede -[NSObject performSelector:withObject:withObject:] + 18 6 UIKit 0x0004205e -[UIApplication sendAction:to:from:forEvent:] + 78 7 UIKit 0x00094d4e -[UIBarButtonItem(Internal) _sendAction:withEvent:] + 86 8 CoreFoundation 0x00058ede -[NSObject per开发者_如何学JAVAformSelector:withObject:withObject:] + 18 9 UIKit 0x0004205e -[UIApplication sendAction:to:from:forEvent:] + 78 10 UIKit 0x00041ffe -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26 11 UIKit 0x00041fd0 -[UIControl sendAction:to:forEvent:] + 32 12 UIKit 0x00041d2a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 350 13 UIKit 0x0004263e -[UIControl touchesEnded:withEvent:] + 330 14 UIKit 0x00041656 -[UIWindow _sendTouchesForEvent:] + 318 15 UIKit 0x00041032 -[UIWindow sendEvent:] + 74
The crash report is not symbolicated. I can tel because of the line :
4 MyApp 0x000042e8 0x1000 + 13032
In a symbolicated crash report, this line would show which of your methods the crash ocurred.
When you create a release build, the debug symbols are stripped from the binary. You need to save the .dSYM file and Application bundle that were in the build folder after building.
These are required to symbolicate crash reports.
If you have these files saved, then you need to make sure they're in a location that spotlight can access. If the crash report was sent to you by the user, try dragging it into the Crash Report tab in Xcode's Organizer window. This should attempt to symbolicate the crash report (but will only succeed if you have the .dSYM and app bundle).
精彩评论