I want to create a Core Data application (I'm using Xcode 4) with support for OS X 10.5. However, I noticed that creating a core-data application generates code using functions available in 10.6 and later e.g URLForResource:withExtension:. Also, there seem to be a lot of changes to how the ManagedObjectContext, PersistentStoreCoordinator and ManagedObjectModel are generated in Xcode 4. Example below:

I was thinking of just copying and pasting this code from a fresh Xcode 3.2 project but I'm not sure if that might break something down the line. Is there a way to make Xcode 4 generate code that will run with 10.5?

1 Answer
1

Make sure you test on a 10.5 system. Do not deploy to 10.5 users without testing, trusting that it will "just work".

Then, you have two choices.

You can look up each API in the documentation, it will state (for instance): "Available on MacOSX 10.6 or later". In this case, you can continue using Xcode 4, but it is tedious (and error-prone). The compiler / linker won't warn you than a method is not available in 10.5, trusting that you are making the right decision.

Use the 10.5 SDK as your base SDK. This is the preferred solution, but requires Xcode 3.2 (which is available for free on developer.apple.com). You don't get to use the new shiny Xcode 4, but that's the price you have to pay to support a 3.5 yo OS (it was released in October 2007).

There is a third choice, installing the 10.5 SDK in Xcode 4, but it is not officially supported so I cannot recommend it in earnest.

If 10.5 support is really important to you and your users, I would strongly recommend Xcode 3 and the 10.5 SDK. That is the least painful combination, in my experience.