当在ipod touch上运行时,不是模拟器..'程序收到信号SIGABRT'
我的应用程序在模拟器中运行得很好,但现在我有开发人员许可证,当我尝试在iPod Touch上运行它时,xcode说GBD: Program received signal: "SIGABRT".
当在ipod touch上运行时,不是模拟器..'程序收到信号SIGABRT'
我该怎么做才能弄清楚问题在这里?建筑时没有警告。
编辑:对不起,这是我第一次在设备上运行应用程序,所以请耐心等待。我只注意到Organizer窗口和调试器给我一个设备上发生了什么的日志。所以这就是问题所在:
[UIApplication setStatusBarHidden:withAnimation:]: unrecognized selector sent to instance 0x1160e0
而且它指的是代码为(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
这是有问题的代码:
'如果(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:]:无法识别的选择发送到实例0x1160e0
的方法似乎不在设备上存在。它被添加到3.2。您的iPod正在运行哪个iOS版本?此外,第二个参数类型是错误的
如果它是低的,你要支持它,你应该考虑
if ([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden:withAnimation:)]) {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
} else {
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
}
当您运行在调试模式下的应用程序,你可以监控控制台(运行 - >控制台)。对于大多数崩溃,你会得到一些错误信息,将指向你正确的方向。另外,在调试视图中,您将能够在应用程序崩溃时(在Xcode的默认布局中调试视图的左上角)看到堆栈。 Xcode会用深色文本突出显示堆栈中属于您的代码的方法。那些是第一批嫌疑犯。
在代码的一开始就粘贴一个断点,然后在调试模式下运行它。使用调试器逐行浏览代码,并查看在SIGABRT发生之前代码得到的距离。
但是,您是否已将iPod touch设置为配置设备?
哦,刚刚发现了别的东西。我不确定您是否将正确的数据发送到withAnimation参数。检查文档:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
应该是这样的:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
运行在调试模式,那么它至少应该告诉你哪一行是造成SIGABRT 。 – vmpstr 2011-01-27 11:49:37