My app runs just fine in the simulator, but now I have a developers license and when I try and run it on my iPod Touch, xcode says GBD: Program received signal: "SIGABRT".
What can i do to figure out what the problem is here? It gives no warnings when building.
EDIT: Sorry, this is my first time running an app on a device, so please bear with me. I just noticed the Organizer window and debugger is giving me a log of what's happening on the device. So this is the problem:
[UIApplication setStatusBarHidden:withAnimation:]: unrecognized selector sent to instance 0x1160e0
And the code it's referring to is in (BOOL)shouldAut开发者_如何学PythonorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
This is the code it has a problem with:
`if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
self.view = clockView;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
return YES;
}
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
self.view = homeView;
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
return YES;
}
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
self.view = homeView; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
return YES;
}
else {
return YES;
}
`
[UIApplication setStatusBarHidden:withAnimation:]: unrecognized selector sent to instance 0x1160e0
The method seems to not exist on your device. It was added on 3.2. Which iOS version is your iPod running? Also, the second parameter type is wrong
If it's lower, and you want to support it, you should consider
if ([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden:withAnimation:)]) {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
} else {
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
}
Stick a breakpoint in at the very start of your code, and run it in debug mode. Use the debugger to step through the code line by line, and see how far your code gets before the SIGABRT occurs.
But have you set up your iPod touch as a provisioning device?
Oh, just spotted something else. I'm not sure you're sending the right data to the withAnimation parameter. Check the documentation:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
Should be something like:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
When you run the app in Debug mode you can monitor the console (Run->Console). For most crashes you will get some kind of error message that will point you in the right direction. Also, in the debugging view, you will be able to see the stack in the moment the app crashed (top left of the debugging view in the default layout in Xcode). Xcode will highlight with dark text the methods in the stack that belong to your code. Those are the first suspects.
精彩评论