Xcode 5 Cocoa App无法在OS X 10.6上加载NIB [英] Xcode 5 Cocoa App Fails to Load Nib on OS X 10.6

查看:506
本文介绍了Xcode 5 Cocoa App无法在OS X 10.6上加载NIB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为10.6和更新的操作系统创建一个Cocoa应用程序。我在Xcode 5(10.9)中创建了一个全新的基于文档的应用程序,并更改了两个设置以使其兼容10.6:我将部署目标更改为10.6,并在MainMenu.xib和xxDocument.xib上关闭Auto Layout,基于文档的模板包含的默认nib。我存档我的应​​用程序(没有代码签名),没有添加其他代码,并测试了它在四个不同的操作系统。以下是结果:

OS X 10.9:按预期启动并显示一个新文档窗口(您的文档内容在此处)。

OS X 10.8:按预期启动;同10.9。

OS X 10.7:无法启动;控制台应用程序产生应用程序名称:无法加载nib文件:MainMenu,退出。

OSX 10.6:无法启动;控制台的产量与10.7相同。

I'm creating a Cocoa application for 10.6 and newer OSs. I created a brand new document-based application in Xcode 5 (10.9) and changed two settings to make it 10.6-compatible: I changed the deployment target to 10.6 and turned Auto Layout off on both MainMenu.xib and xxDocument.xib, the two default nibs that are included with the document-based template. I archived my application (no code signing) adding no other code and tested it on four different OSs. Here are the results:
OS X 10.9: Launches and shows a new document window ("Your document contents here") as expected.
OS X 10.8: Launches as expected; same as 10.9.
OS X 10.7: Fails to launch; Console applications yields "App Name: Unable to load nib file: MainMenu, exiting".
OSX 10.6: Fails to launch; Console yields same as 10.7.

我对我的应用程序的行为很感到困惑。我绝对没有添加任何代码到Xcode为我创建的模板基于文档的应用程序;我只是更改了所需的设置,使其与10.6和更高版本兼容。我也尝试关闭ARC在构建设置,这没有什么区别。我检查了苹果文档,还搜索有关我收到的控制台错误的其他问题,但没有一个与这个问题有关。我非常惊讶,10.7表现出这种行为,因为10.7是与ARC兼容。我将非常感谢任何建议,如何我可以解决这个问题。我怀疑有一个很容易修改默认模板,因为苹果可能不提供一个模板,需要大量的修改,只是让它工作。谢谢。

I'm quite baffled as to the behavior of my application. I added absolutely no code to the template document-based app that Xcode created for me; I just changed the required settings to make it compatible with 10.6 and up. I also tried turning off ARC in the build settings, which made no difference at all. I checked Apple docs and also searched for other questions about the console error I received, but none of them were related to this problem. I was very surprised that 10.7 exhibited this behavior, as 10.7 is compatible with ARC. I would greatly appreciate any advice on how I can fix this problem. I would suspect that there is an easy modification to the default template, as Apple probably wouldn't supply a template that requires extensive modification to merely get it working. Thanks.

更新:
根据建议,我在Xcode中关闭了基本国际化。我运行的应用程序,它工作正常。我导出应用程序(无代码签名),并在所有上述操作系统上测试。这一次,我收到的错误发生在所有操作系统。这甚至发生在我构建项目的同一台机器上,唯一的区别是,我没有从Xcode运行它。我的下一步是实际创建一个MainMenu.xib文件(因为删除基本国际化删除了旧的),并将其设置为主接口。现在,不仅我得到在所有操作系统上导出的应用程序的错误,但它显示在Xcode当我尝试运行应用程序!是否还有其他我缺少的东西?

UPDATE: As suggested, I turned off base internationalization in Xcode. I ran the app, and it worked fine. I exported the application (no code signing) and tested on all of the above OSs. This time, the error that I received above occurred for all OSs. This even occurred on the SAME machine that I built the project with, the only difference is that I didn't run it from Xcode. My next step was to actually make a MainMenu.xib file (because removing base internationalization deleted the old one) and set that as the main interface. Now not only do I get the error in the exported application on all OSs, but it shows up in Xcode when I try to run the application! Is there something else that I am missing?

推荐答案

新创建的Xcode 5项目的基础国际化开启。基本国际化在OS X 10.8及更高版本上受支持。您必须关闭基本国际化以支持10.7和10.6。有关详细信息,请参阅以下Stack Overflow问题:

Newly created Xcode 5 projects have base internationalization turned on. Base internationalization is supported on OS X 10.8 and later. You'll have to turn off base internationalization to support 10.7 and 10.6. See the following Stack Overflow question for more information:

在Mac OS X 10.8之前编译目标时,Base.lproj / MainMenu.xib不可用

您可能需要做的另一件事是支持10.6是为项目和xib文件设置部署目标为10.6。我知道你说你在你的问题中将部署目标设置为10.6,但不清楚是否为项目和xib文件设置它。正如你所发现的那样,苹果的项目模板不会高度重视与旧版操作系统的兼容性。

Another thing you may need to do to support 10.6 is to set the deployment target to 10.6 for both the project and the xib files. I know you said you set the deployment target to 10.6 in your question, but it wasn't clear if you set it for both the project and the xib files. As you're discovering, Apple's project templates do not place a high priority on compatibility with old OS versions.

这篇关于Xcode 5 Cocoa App无法在OS X 10.6上加载NIB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆