xcode 由于“无法加载捆绑中的 NIB”,iOS 应用程序崩溃

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11664343/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:01:53  来源:igfitidea点击:

iOS app Crash due to "Could not load NIB in bundle"

iphoneiosxcode

提问by JaNa Saadeddin

when i run the simulator there is a crash and i don't know why it give me this " Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ViewController_iPhone''" could anyone help me ?

当我运行模拟器时发生崩溃,我不知道为什么它会给我这个“由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无法加载捆绑包中的NIB:'NSBundle(加载)'与名称' ViewController_iPhone''" 谁能帮帮我?

回答by sergio

Are you sure that a "ViewController_iPhone.xib" file has been added to your project?

您确定“ViewController_iPhone.xib”文件已添加到您的项目中吗?

Either add it to your project/target, or (if it already there) check the nib name you are using on the statement that is causing the crash, or check your info.plist file if the crash happens at startup.

将它添加到您的项目/目标,或者(如果它已经存在)检查您在导致崩溃的语句中使用的笔尖名称,或者如果崩溃发生在启动时检查您的 info.plist 文件。

If everything is correct, clean your project and build again.

如果一切正常,请清理您的项目并重新构建。

回答by Ronen Morecki

I got the same, when working on iOS7 and get the crash when running on iOS6

我得到了同样的结果,在 iOS7 上工作时在 iOS6 上运行时崩溃

To solve it:

要解决它:

If you are using xCode5 you should go to your Xib file and change the "Interface Builder Document" to view as iOS6.1 or earlier or change the "opens in" xcode version to 4.6 instead of 5.0

如果您使用的是 xCode5,您应该转到您的 Xib 文件并将“Interface Builder Document”更改为 iOS6.1 或更早版本,或者将“opens in”xcode 版本更改为 4.6 而不是 5.0

It solved the issue for me

它为我解决了这个问题