What is the XIB deployment target? (OS X and iOS) - xcode

My app must run on OS X 10.6 through 10.9. The main window xib has a deployment target of 10.6 (same as the app itself). The main window nib also has the "Full Screen" attribute set to "Primary Window".
Since 10.6 doesn't support NSWindowCollectionBehaviorFullScreenPrimary, XCode 5 expectedly gives the warning Attribute Unavailable. Full Screen behavior on OS X prior to 10.7.
Questions
Can you ignore this warning and build safely for 10.6 without a crash on nib instantiation?
You can remove this warning by setting the xib deployment target to 10.7, but will the nib still run on 10.6? In other words, doesn't a xib deployment target of 10.7 cut off support for 10.6?
The "proper" solution seems to be to keep the deployment target at 10.6, unset the Full Screen attribute in the xib, and instead set it programmatically at runtime if running on 10.7+. Is this how you should always handle situations like this?
Generally, how does OS X fall back when attributes specified in nibs don't exist at runtime? I can't find a straight answer. Thank you.

The deployment target is the earliest OS version that can load the xib file. To answer Question 2, setting the deployment target to 10.7 cuts off support for 10.6. The nib file will not run on 10.6.
You listed the solution for supporting 10.6 and later in Question 3. I don't have an answer for Question 4.

Related

Incompatibility 10.10 to 10.8

I have an app developped under Xcode7 in 10.10
I changed the deployment target system to 10.8 because of the IT situation of another school.
The 10.8 app runs fine under 10.10, but on an 10.8 machine, I only see a window grayed out in the face of the MainMenu.xib included the menus, but inactive. Its reaction are as in IB. The previous login windows called at startup are not shown.
In the console I only see a warning about 'Invalid color System labelColor'.
Explanation:
I reduced my project to the Start nib window and the MainMenu.xib. I looked for labelColor in every single nib and xib file with BBedit.
When I compile, I look in the content of the compiled app and can find a MainMenu.nib (not xib) with a single String Item labelColor.
Runnig the app in 10.10 is fine, but in 10.9 the warning appears.
Explanation 2:
Problem fixed: The labelColor is inserted in 10.10/Xcode7 with an NSBox inserted in IB. Obviously this was changed when I transfered the rather old project to Xcode7. I don't know if this is changeble.

Xcode 6.3.2 build for OS X 10.7

Hope you can help me with a strange problem, no clue what I am doing wrong.
On Xcode 6.3.2 I want to build an app able to run on OS X 10.7.
So I started with a new Cocoa Application (Obj-C), naming it "Test". I set the Deployment Target to 10.7. Leaving the application empty I can build and run it on my main machine (OS X 10.10.3). Running wt will show an empty window ok.
Now I archive it and in the Organizer export it as a Mac application. Again all works fine, no errors. Now if I run it on the target machine (running 10.7.5) it will start, but no window will show up. Also the menu of the app will only show its name, all other menu items are missing.
What am I doing wrong?
You probably created the project to use a storyboard, which is not supported by OS X 10.7. You need to use a MainMenu NIB. You also need to make sure you don't use any features that were introduced after 10.7.
Also, when an app fails like this, you should check the console log to see if it logged any errors. You can view that using /Applications/Utilities/Console.app.

Xcode 5 Cocoa App Fails to Load Nib on OS X 10.6

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?
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.
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.

How can I delete the Xcode constraints?

I upgraded to Mavericks and installed Xcode 5.0.1.
I opened one of my projects, which targets 10.6, and declined the option to upgrade to "Upgrade to take advantage of Xcode 5 features?" which mentioned Auto layout.
Now 2 of my xib files have errors (the other 12 seem OK):-
error: Illegal Configuration: Auto Layout on OS X prior to 10.7
warning: Attribute Unavailable: Identifier on OS X versions prior to 10.7
Attribute Unavailable: Automatically Recalculates Cell Size on OS X versions prior to 10.8 - 0n NSMatrix
How can I delete the constraints?
See this SO answer
You need to disable autolayout for the NIB completely since 10.6 doesn't support it at all.
If disabling autolayout doesn't clear the other two warnings, you should be able to click the "!" warning symbol to be taken to the offending setting. Looks like a couple of checkboxes simply need to be unchecked.

Application is not working on 10.6

I'm currently working on a port of my Windows game for Mac OS X, it runs fine on my Mac when compiled with Xcode 4.5.2 on OS X 10.8, but it crashes on a friends Mac running 10.6. At first I thought it was due to one of the Frameworks I've been using, but the standard Cocoa app template crashes at well, without any visible error message.
I already tried setting the Deployment Target to 10.5, but this doesn't change anything. When starting the App, it appears for a short time in the Dock and then disappears without showing any kind of UI or error message.

Resources