How to target previous version of iOS in XCode4? - iphone

How can I target a previous version of iOS in XCode4? My app is building only for iOS 4.3 devices and I'd like users with iOS 3.0 installed to be able to run the app as well.

Select the project in the Project Navigator and the then the target in the detail view. Under the summary tab you have the Deployment Target. Set it to 3.0. Alternatively you can set the iOS Deployment Target in the build settings. Both ways change the same parameter, it's just two different ways to access it.
This will allow your app to run on iOS 3.0 but it's still compiling against SDK 4.3 which is required by Xcode 4. So be careful that you don't use any SDK items that require an OS newer than 3.0 or if you do that they're properly checked with an if statement. These issues can be a bit of a pain since they manifest themselves at runtime.

Related

Is it possible to compile an iPhone App for IOS 4.0 using Xcode 4

Does anyone know how to compile an iPhone app targeting iOS 4.0 using Xcode 4?
It seems that it is only possible to select iOS 4.2 as target.
Thanks in advance
Peter
There's a "Deployment Target" setting and a "Base SDK" setting. You can set the deployment target by clicking on the project name at the top of the tree, then bring up the "Summary" page. Deployment Target is the 4th item, and can be set to 4.0.
"Base SDK" is on the "Build Settings" page and is usually the latest SDK you have installed, but can be set to older SDKs if you go to the trouble to keep them around. Normally you shouldn't need to though, because apps built with newer SDKs should run on older iOS versions as long as you restrict your coding to the older API.
So an app built with the 4.2 SDK should run fine on iOS 4.0 if you set the deployment target to 4.0 or earlier and don't use any methods introduced after 4.0.
See also:
How to target previous version of iOS in XCode4?
What's the real difference between Base SDK and Deployment Target or Deployment OS Version?
How to target 4.2 version with XCode 4
iOS deployment target set to iOS 4.2. Will the app run on devices running earlier versions of iOS?

Base-SDK of v4.0 means it won't install on 4.1 or 4.2 devices?

I was using xCode v3.2.3 and SDK 4.0 to write iPhone apps that worked on my iOS v3.1.3 device... as well as v4.0. (Deployment target set to 3.1.3. Base SDK set to v4.0)
Does that mean everyone that uses my app will need a minimum of iOS 3.1.3 and a maximum of v4.0? Or will they also run on v4.1 and v4.2?
Second part of my question:
I now upgrade my iOS v3.1.3 to v4.2.1.
Xcode now says my v4.2.1 device is now no longer provisioned.
Doesn't a Base-SDK setting of v4.0 mean apps will also run (or at least install) on v4.x?
No. Base SDK just means that your app will be built against the iOS 4.0 libraries. Any 4.x device will be able to run a release build of your app, but for debugging, Base SDK and the iOS version on your device must match. In the end, you need to build your app with the newest available Base SDK anyway, because Apple won't accept apps built for older SDKs into the App Store.
No, they will. iOS has Backward compatibility.
I agree with Irene. I found the solution:
The hint came from here: Can't make Xcode 4 run a barely empty project using SDK 4.2 (runs fine in 4.3)
And this is how i resolve: my xcode 4.0 my SDK 4.3 and my Ipod touch device is 4.2.1 - You see it is backward compatible. There are 2 things you must do in order to resolve. 1) In your xcode 4.0, You click on your project name under Target to ensure you change the target not the Project setting. Find the row >IOS deployment target to the version of your device in my case it was back to 4.2.1 ipodtouch so i set 4.2 (do not worry about basesdk it is for your application not the same as your application's target. 4.3 basesdk requires you provide codesign so you have to select code sign if do not have one apply for one looking up in Apple website or google)
After setting your target to compatible version with your device you now can go to "set the active scheme" that is where you select which device to install and run on including the simulator. So you will find you device there select it and you are good to go.
And if you still can not get it going. You can try to select your project under Project this time adn set the ios deployment target to your version mine was 4.2 ipodtouch ios. Then go select "set the active scheme" that is where you select which device to install and run on including the simulator. So you will find you device there select it and you are good to go.

XCODE Base SDK missing

The only option I am able to see in my Base SDK is IOS 4.2 but I can see all SDK versions in IOS Deployment Target. I am trying to run a project which was written using IOS 3.2 do able to run the current XCODE settings.
Any clue?
If you don't have anything incompatible between the iOS 3 and iOS 4 APIs, you should be able to compile and run successfully by changing the Base SDK setting on Project - Edit Project settings (Build tab), and Edit Active Target. Those are the two places that make reference to the original SDK you used (3.2), and the two places you should change to reflect your current SDK (4.2).
yes, change base SDK to "latest iOS" or one which is available with your XCode installation; that should work.
deployment target is the OS version on which the app should be able to run, base SDK is the version you compile and test the app with.

iOS4 Compatibility for iPhone App

I want to upgrade my iPhone app from iOS3 to iOS4.
Once I upgrade to iOS4, which versions of previous iOS does the app support?
For eg. will it support iOS3, iOS2, etc.
Thanks!
It will depend on what features you implement. If you implement a feature that is specific to iOS 4 (like in-app sms), then that feature will not run on previous versions. In some cases this may cause you app to not function on old versions. Make sure the feature is available at runtime before you try to use it.
In your target's build settings there is 'Base SDK' and 'Deployment Target'. 'Base SDK' is the newest iOS that you want to compile for, while 'Deployment Target' is the oldest iOS that you want your app to function on.
You can set the Deployment Target of your application to the base version of the SDK that you want your app to be compatible with. Once set, your app will be compatible with all versions of the SDK from the deployment target through the current version.
The iOS 4 SDK can build an app that'll run on iOS 3.0—by setting the project's Deployment Target to same—but no earlier. On the other hand, just about nobody is still running 2.x, so that limitation isn't likely to be a problem.

Compiling for iOS 3.1.3, using xcode 3.2.3 (and iOS 4 that came with it)

I've downloaded the final version (and never installed any beta versions before) of xcode 3.2.3 with sdk 4, and now I can't seem to find a way to compile my app for a 3.1.3 iOS.
Does anybody know how can I do that ?
As it is, you can't. They probably did this on purpose to discourage new apps compiled for 3.1.3 which foils multitasking.
Instead you can compile for iOS 4 but make your deployment target 3.1.3. This doesn't really require any more real work, as long as you don't use any non-3.1.3 methods/classes etc. and the application can install and run on a 3.1.3 device. You can also then make your application multitasking aware so that it works nicely on a device that does run iOS 4 and is capable of multitasking.
Just a note: the Base SDK may be set at the project level, but you will need to go to the build settings for the target itself to set the deployment target (that setting is not available at the project level).
To expand on Jason Coco's answer:
If you go to the Project Info screen and click Build, you can choose what Base SDK to use (4.0) and then scroll down to iPhone OS Deployment Target version and set it to 3.1.3 or whatever.
However, you also have to go to the Targets section under Groups & Files (red bullseye) select your target and get the Info build page, and set your iPhone OS Deployment Target there too.
Once that's done, you should be able to test it with a device that's still running 3.0 or whatever you selected.
if you want to be compatible with iPhone OS 3.x you still compile for SDK 4.0, but open target settings and choose that application can run on 3.x (iPhone OS Deployment Target). If you did not use any iOS 4.0 specific APIs then your app will run smoothly on 3.x and 4.x, here is a screenshot of setting to change:
Screenshot