错误:无法加载 NSMainNibFile MainWindow
当我运行我的应用程序时,它会记录以下错误:
Failed to load NSMainNibFile MainWindow.
什么可能导致此错误?
When I run my application, it logs out the following error:
Failed to load NSMainNibFile MainWindow.
What could cause this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 main() 函数,通常在 main.m 中。应该调用 UIApplicationMain()。最后两个参数是主体类和应用程序委托类。它们通常都是 nil,在这种情况下,UIApplication 将是主类,委托来自应用程序 Info.plist 文件中 NSMainNibFile 键指定的 nib 文件。
如果您收到上述错误,很可能意味着应用程序找不到该文件。查看应用程序的 Info.plist(或等效地,目标设置中“摘要”选项卡下的“主界面”设置)并查看为主 nib 文件指定的内容。确保项目中存在具有相同基本名称的 .xib 文件(例如:MainWindow.xib)。请记住:iOS 文件系统区分大小写,因此文件的命名应与 Info.plist 中指定的完全相同。
Look in your main() function, usually in main.m. There should be a call to UIApplicationMain(). The last two arguments are the principal class and the application delegate class. These are often both nil, in which case the UIApplication will be the principal class and the delegate comes from the nib file specified by the NSMainNibFile key in the app's Info.plist file.
If you're getting the error above, it most likely means that the application can't find that file. Look at your app's Info.plist (or equivalently, the Main Interface setting under the Summary tab in the target's settings) and see what's specified for the main nib file. Make sure that there's a .xib file with that same base name (example: MainWindow.xib) in the project. Remember: the iOS filesystem is case-sensitive, so the file should be named exactly as it's specified in the Info.plist.