当在 iPod touch 上运行时,而不是模拟器上运行时..“程序收到信号 SIGABRT”

发布于 2024-10-14 13:12:09 字数 1249 浏览 5 评论 0原文

我的应用程序在模拟器中运行得很好,但现在我有开发人员许可证,当我尝试在 iPod Touch 上运行它时,xcode 显示 GBD: 程序收到信号:“SIGABRT”。

我能做什么找出问题所在?构建时它不会发出警告。

编辑:抱歉,这是我第一次在设备上运行应用程序,所以请耐心等待。我刚刚注意到管理器窗口和调试器为我提供了设备上发生的情况的日志。所以这就是问题所在:

[UIApplication setStatusBarHidden:withAnimation:]: unrecognized selector sent to instance 0x1160e0

它引用的代码位于 (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

这是有问题的代码:

`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 shareApplication] setStatusBarHidden:NO withAnimation:NO];

    return YES;
}
else {
    return YES;
}

`

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)shouldAutorotateToInterfaceOrientation:(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;
}

`

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

久伴你 2024-10-21 13:12:09

[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];
    }

[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];
    }
故笙诉离歌 2024-10-21 13:12:09

在代码的开头放置一个断点,并在调试模式下运行它。使用调试器逐行单步执行代码,并查看代码在 SIGABRT 发生之前走了多远。

但是您是否已将 iPod touch 设置为配置设备?

哦,刚刚发现了一些别的东西。我不确定您是否将正确的数据发送到 withAnimation 参数。检查文档:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO]; 

应该是这样的:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; 

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]; 
爱要勇敢去追 2024-10-21 13:12:09

当您在调试模式下运行应用程序时,您可以监视控制台(运行->控制台)。对于大多数崩溃,您会收到某种错误消息,为您指明正确的方向。此外,在调试视图中,您将能够在应用程序崩溃时看到堆栈(Xcode 默认布局中调试视图的左上角)。 Xcode 将以深色文本突出显示堆栈中属于您的代码的方法。这些是第一批嫌疑人。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文