xcode 更改 xib 时 iPhone 上的 SIGABRT
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1480915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SIGABRT on iPhone when changing xib
提问by Boz
I've just finished off an app for the iPhone which, until today, ran fine on the iPhone simulator and actual devices.
我刚刚完成了一个 iPhone 应用程序,直到今天,它在 iPhone 模拟器和实际设备上运行良好。
I tried changing the xib which is loaded in the applicationDidFinishLaunching method in my application delegate class - all I did was change the string in initWithNibName.
我尝试更改在我的应用程序委托类中的 applicationDidFinishLaunching 方法中加载的 xib - 我所做的只是更改了 initWithNibName 中的字符串。
When I launch the app on the simulator, the Default.png image is shown, then the app crashes with an uncaught exception. When running on a device, the Default.png image is shown for about 10 seconds, the UI is never loaded and I get 'GDB: Program received signal: "SIGABRT".' on the Xcode status bar. Debugging shows that applicationDidFinishLaunching is never actually reached before the app crashes.
当我在模拟器上启动应用程序时,会显示 Default.png 图像,然后应用程序因未捕获的异常而崩溃。在设备上运行时,Default.png 图像显示约 10 秒,UI 从未加载,我收到“GDB:程序接收信号:“SIGABRT”。在 Xcode 状态栏上。调试显示 applicationDidFinishLaunching 在应用程序崩溃之前实际上从未达到过。
Setting the starting xib back to the original solves the issue, but now I've made a change and saved it in the Interface Builder and the app shows the same issues as above - I've made no code changes at all.
将起始 xib 设置回原来的解决了这个问题,但现在我做了一个更改并将它保存在界面生成器中,应用程序显示了与上面相同的问题 - 我根本没有做任何代码更改。
Is this a memory issue, or a known issue of a common mistake?
这是内存问题还是常见错误的已知问题?
NOTE: I've made no code changes whatsoever, and the only changes I've made to the xib are cosmetic, the IBOutlets are all intact.
注意:我没有做任何代码更改,我对 xib 所做的唯一更改是装饰性的,IBOutlets 都完好无损。
采纳答案by Boz
Sorry guys, my fault - it appears I deleted the MainWindow.xib file, so the delegate wasn't called on startup after I made changes. I've recreated it and linked it to the app delegate and UIApplication so now everything works.
对不起,我的错 - 看来我删除了 MainWindow.xib 文件,所以在我进行更改后启动时没有调用委托。我重新创建了它并将它链接到应用程序委托和 UIApplication,所以现在一切正常。
回答by Nikolai Ruhe
You probably changed an IBOutlet's name in code without changing it in the xib.
您可能在代码中更改了 IBOutlet 的名称,而没有在 xib 中更改它。
回答by brian.clear
I renamed some classes and Xibs and got SIGABRT into main.m
我重命名了一些类和 Xib 并将 SIGABRT 放入 main.m
the Class name in Identity Inspector may be pointing to non existant class name
Identity Inspector 中的类名可能指向不存在的类名
回答by Kasaname
its because in the initWithNibName you are not giving the correct xib name so it will crash
这是因为在 initWithNibName 中你没有给出正确的 xib 名称所以它会崩溃
回答by mahboudz
You probably had IBOutlets connected from a xib back into your code, and those connections are broken.
您可能已将 IBOutlets 从 xib 连接回您的代码,但这些连接已断开。
You'll have to give us a little more detail on how the nibname string was changed. Did you rename your xib file?
您必须向我们提供有关如何更改 nibname 字符串的更多详细信息。你重命名了你的xib文件吗?