Will Mac application developed in latest XCode work in old OS-X? - objective-c

I have MacOS-X - 10.7 and Xcode - 4.6.2 and made a Mac application. The client side machine is also MacOS-X - 10.7. But in my mac application there was a small error with NSNumberFormatter which when I was changing, Xcode was crashing. So I edited the code in latest Xcode and OSX. And then I made the binary of it and run in MacOS-x - 10.7, its working fine. But the source code is no more opening in Xcode - 4.6.2. Its asking for the latest version of Xcode. My question is will the binary will work fine in older version of OS-X even if it is developed in latest Xcode?

The version of OS X which your application will run on is dictated by the OS X Deployment Target in the project settings. If that is set to support 10.7, then it doesn't matter which version of OS X you built it on: the built application will work on 10.7 and later.
This setting will also set the minimum allowed OS in the Info.plist, so people trying to run the build on earlier OSes will see an alert instead of the app just crashing.
More information on setting the deployment target and building for different OS versions with SDKs is available in the Apple documentation:
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html

Related

How to update mac OS application to support Catalina?

I have an old mac OS application developed in Mojave with the deployment target 10.12. Now how to update mac OS application to support Catalina? Or is the application automatically supports all future mac OS versions?
When developing for macOS (or any other Apple platform, for that matter), there are two key concepts to take into account when thinking about compatibility:
The SDK version: this is the SDK you're compiling against and it is usually determined by the Xcode version you're using to build your project.
The Deployment Target: this is the lowest OS version you want to support.
Normally, if you have followed the best practice in implementing your code and all of your dependencies have done the same, updating an app for a new macOS version requires only to download the latest Xcode on the latest macOS, build it and run your smoke tests (manually or through automated tests).
There may be things that have been deprecated in the meantime and Xcode will report them as warnings while building. You may read more about deprecated APIs in the macOS 10.15 release notes.
Keep in mind that you don't actually have to rebuild your app every time a new macOS version comes out. Even though it is better to test it at least once and dedicate time to explore and make use of new APIs, apps built on the previous version of macOS will, most of the times, run flawlessly on the next version (and maybe even further). This obviously depends on the app complexity, so your mileage may vary.

App Crashing after updating from 10.9.3 to 10.9.1

I have mac version 10.9.3 and I am using xcode 5.1 on which I set build target 10.9. Now when I am running its build no 10.9.3 or latter versions it is good. But on previous versions it is not running.
It has solved, basically it was the problem with code signing. When I changed the code signing with Mac developer, the issue has resolved.

Backward compatibility for OSX Apps

OK, so here's my situation :
I've got Xcode 5.1.1 on a 10.9 (Mavericks) machine
I want to build my app so that it runs on 10.6 and later
SDKs installed : 10.6, 10.8, 10.9
What do I have to do to make sure it'll show up as "10.6 and later" compatible in the app store?
I managed to get it to compile fine with Base SDK set to either 10.8 or 10.9, and Deployment Target set to 10.6. Will that suffice?
P.S. I've tried compiling with Base SDK set to 10.6, as well, but there are so many errors to be fixed, that it'd be better if I could avoid it.
So any ideas?
Yes; using 10.9 SDK with the deployment target of 10.6 will work fine.
You may find you have conditional code-paths which must be determined at runtime, perhaps based on respondsToSelector, which will require some #pragmas in order to compile successfully.
The Deployment Target defines the minimum OS version that your app requires at run time.
The Base SDK defines the level of API features that are available at compile time.
Therefore you can use 10.9 as Base SDK when building apps that can run on 10.6 and upwards.
You just have to make sure to avoid code paths that use 10.7/10.8/10.9 APIs when your app runs on a 10.6 machine.
As trojanfoe already pointed out, you can use respondsToSelector: to check if a certain class/method is available.
Another way is to use NSAppKitVersionNumber:
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_8)
The NSAppKitVersionNumber constants for the latest SDK can be found in the AppKit Release Notes.
Further details can be found in Apple's SDK Compatibility Guide.

Xcode app version not compatible with Mac OS X version

am using Os X 10.6.4 and X code Version 3.2.3 for developing some simple app files and using PackageMaker to distribute these app files. But when trying to run the package on some other mac I am getting error that the package is not compatible with the Os X its running and file would not be installed. Is this a problem with X code or package maker. sorry for reposting it but although I tried changing base SDK to 10.5, it was getting compiled and ran well on mac I am using for development (Mac OS X 10.6.4) but when installed on mac running OS X 10.5 the .app files were grayed out and message poped up saying 'you cannot use this version of application with this version of Mac'. Any idea why is this happening? Also as mentioned earlier I am using IBOutlet for accepting user date from form and then writing that into a text file. Any idea or solution about it?
Do you have anything set in your Info.plist for the LSMinimumSystemVersion key? This is one place the system looks.
When I was brand new I had trouble figuring this out...
Make sure that your Base SDK and deployment target are 10.5 and that you have the right compiler on(GCG4.0/4.2), also make sure that when you change these settings you change it for both Release and Debug, I once made this mistake of changing it only on debug, and when I built for release it only worked on 10.6 because I didn't change those settings.

Debug 10.6 Project into 10.5?

Can I debug a 10.6 project into a 10.5? I have computers at school that are still 10.5 and I need to downgrade it so I can run my program on their computers.
Thanks,,
Kevin
I assume you mean you want to load your Xcode project onto the school computers.
First, are you using any 10.6 specific APIs? If so, you can't run your app on 10.5.
Right click on your project and Get Info. Then check some things:
General->Project Format: Is this an Xcode version that will be compatible with the school computer? 10.5 will be an Xcode 3.1.x system (pretty sure about this, though it could be 3.0.x)
Build->Base SDK. Is this set to 10.5?
If those look good, you should be set.
If you build against the 10.6 SDK, you can only run on 10.6 and higher.
If you build against the 10.5 SDK, you can run on 10.5, 10.6 and higher.