Xcode built app on 10.6 wont run on 10.5.8 - cocoa

I am new here and new in Xcode world.
I made a simple app with Xcode 3.2 on Snow Leopard.
The resulting built app works on snow leopard, however it will not even start on leopard (10.5.8) - I get message "You cannot use this version of application with this version of Mac OS X". Is it normal?
Or is there a way to make app that will work both on Snow Leopard and Leopard? Please advise, as I have no way to find out myself
Thanks for any input

You need to change the deployment target in your Build Settings. You should set it to the lowest version of OS X that you're willing to provide support for. You should set your base SDK to the latest available public SDK.
If you do this, you must ensure that you only use new 10.6-only APIs after doing runtime checks for their existence. To do this, you can use functions like NSClassFromString and respondsToSelector:.
Any Frameworks or libraries that are new to 10.6 should be weak-linked. This will prevent the app from trying to load those frameworks on 10.5 and thus cause the program to crash when it doesn't find the frameworks.
All explained in the SDK Compatibility Guide from Apple (Requires (free) login).

Related

Xcode for mac OS X 10.6.3?

Is there a version of xcode available for mac OS X 10.6.3? I did several searches on google but the only versions that i find is for 10.6.6 and up.
And xcode 3.2.5 is for leopard and not snow leopard.
I want to use it for developing for Iphone and Ipad.
Thanks.
Have you checked here: http://connect.apple.com/
You need to login using your Apple ID. Also, as Analog File mentioned, that version is probably deprecated and you won't be able to submit your app to the App Store if you build one with it.

How do I add Leopard and Snow Leopard support to a Lion Cocoa App?

I have developed a Cocoa App on Lion and now I would like to add compatibility with Leopard and Snow Leopard.
I tried to set the development target to 10.5 but it still has crash problems on Leopard and Snow Leopard.
I tried also to open the project with old versions of Xcode, but I get hundreds of compile errors (I guess it's because I can't compile the program with the old Mac OS SDK)
Do you have any advice about solving the retro-compatibility problems of Cocoa Apps?
I think it's generally not a very good idea to develop for the latest OS then try to support older OSes at the last minute. If you've used any APIs that were introduced in an OS later than the oldest you're trying to support, you'll have to rewrite code to avoid using those APIs. It's generally not worth the trouble.
That said, there's no secret to supporting older OSes. You just need to make sure that you only use APIs (classes, methods, functions) that are available on the oldest OS you're trying to support. You'll notice when looking at the documentation that for each method, under "Availability", it will tell you which versions of the OS include that method. Something like:
Availability
Available in Mac OS X v10.6 and later.
Assuming you don't use any APIs not available on an OS version you're targeting, all you need to do is set the deployment target to the lowest OS you're targeting, and build. You will of course also want to test thoroughly on each OS version you're supporting.
Your question would be easier to answer in more detail if you elaborated on the "crash problems" you're seeing on Leopard and Snow Leopard.
First, install the 10.5 SDK on your Mac. This may not be necessary, but do it anyway. You can find instructions on the Internet. Keep in mind that compiling with the 10.5 SDK will ensure compatibility, but you won't be able to use newer OS X features unless you load them dynamically.
Second, go into your .xib files and on the File Properties tab (first notch in the Inspector pane) disable auto layout and set the deployment target to 10.5.

AppStore Update Policy

Just wondering what will happen if the current app version supports OS 10.6.6 upwards and you upload a version that is built for Lion.
Will the 10.6 users be still able to download the version that is for 10.6 or will they be forced to upgrade to 10.7? My guess is the latter, but I'm not 100% sure.
How would you handle the jump from 10.6 to 10.7?
Apple's storefront database knows which version of OS X your app currently requires (the Deployment Target), and thus might not allow the App Store application on your Mac to update an app if the Mac on which the App Store application is running does not have a proper OS version for that app.
Any update replaces the previous version. If the new version you plan to release requires 10.7, then I strongly encourage you to disclose that information in the update so that users who plan not to upgrade right away will know not to install your update.

Using xcode 4 but targeting OSX Leopard (10.5) and above

I was developing an application using xcode 4 to target snow leopard (10.6)
Now, nearly the end of the development, I've been asked to support 10.5+.
I have set the Mac OS deployment target to 10.5 and compiled.
The compiler (LLVM 2.0) and linker seems to be happy with the change
but I came across a feature I've used from NSWindow (isOnActiveSpace) which is states as AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
This I understand states that it won't work (throw exception?) in 10.5 but no warning were raised when building.
I currently don't have a leopard installation and it will take our QA some time to arrange a computer for that, so in your experience, what should I do next? how can I go over the code and make sure that all the APIs I've used are in fact safe for 10.5?
Set MAC_OS_X_VERSION_MAX_ALLOWED to 1050 and see what symbols disappear. More info in TN2064.

Test build of Cocoa application not compatible with tester's version of OS X

I've been building a basic Cocoa application with Core Data and Interface Builder, and no extra coding, frameworks, or header files. I sent it to someone to test on their machine (a last-gen G5 iMac), and they got a message saying that their machine couldn't run it. I discovered the switch to compile for PPC, so I built a PPC version of the application to try out, and that produced the following error message:
You cannot use this version of Application on this version of Mac OS X.
I'm running Xcode 3.2.1, Interface Builder 3.2.1, and OS 10.6.2. The conversation with my tester was a bit confusing; at first it sounded like she only had Tiger on her machine, saying Leopard was incompatible (I corrected and said that Leopard should be, it's Snow Leopard that isn't), and then by the end of the conversation she was about certain that her machine was running Leopard, but had already shut it off by then. So I'm not sure which version of OS X is on the offending iMac, but it's the latest version of either 10.4.11 or 10.5.8 (the tester is in a remote location, so I can't verify personally at the moment).
What can I tweak to try and improve compatibility on my tester's machine?
If they're seeing that message, it's most likely because your app has the LSMinimumSystemVersion key (Minimum system version) set in the Info.plist. You should take this key out or set it to the actual the minimum OS X version you support.
Once you do this, you may well run into the next problem. (Probably a dynamic linker error as a result of using a framework or API that didn't yet exist on 10.4 or 10.5.)
The main problem here is that you're sending it out to a system where you haven't actually tried it. If you plan to support 10.4, 10.5, or both, I highly recommend that you find a spare hard drive, partition it up, and install 10.4.11 and 10.5.8. There are many issues that will crop up on older OS's and if you haven't tried it yourself, it's unlikely it will work smoothly on the first try.

Resources