Question

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.

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.

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?

Was it helpful?

Solution 2

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:

Base.lproj/MainMenu.xib is not available when compiling for targets before Mac OS X 10.8

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.

OTHER TIPS

AS mentioned before you need to disable Internationalization Base.

In the Project Navigator Click on the on the first item which is your project (denoted by blue page with white A in it, it is the root of all other items)

You should by default see the Info page to the left (if not select it from the tab at the top)

The last item in the Info property sheet is Localization. Under Localization you will have the ability to add and remove languages and you should by default have two already Base, and English.

Delete both, and deselect the check box "Use Base Internationalization"

Once you have done this, remove the any *.xib files you have from the project itself. MAKE SURE TO ONLY REMOVE REFERENCES !!!DO NOT SEND TO TRASH!!!

Once the references have been removed, go into Finder, Open your project directory and you will find a directory called Base.lproj with your *.xib files located in them. Copy or move them one level up to your project directory, and delete Base.lproj directory.

Go back into xCode and add back in your *.xib files. ++K to clean the project, then ++R to rebuild.

This should move the *.xib files in the App Package from Base.lproj (where 10.6 does not seem to find them) to the Resources file folder, and solve the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top