Xcode: Architectures settings for a universal\iOS4 app - iphone

I was wondering what my project settings should be in case I have a universal app that I am now updating to 4.0.
The Base SDK is iPhone Device 4.0
iPhone OS Deployment Target is iPhone OS 3.0
What should I enter in the Architectures, Build Active Architecture Only checkbox and the Valis Architectures for the different configurations (debug, release)?
Also, since some of my apps are not universal but will support 4.0 as base and 3.0 as deployment, will it make any difference is the architectures settings?
Thanks
Roi

Base SDK should be set to the most recent version of the SDK (ie: 4.2) this is what you build against and ensures that your app works properly on new OS's. Xcode now has a 'Latest iOS' selection which I recommend.
Deployment Target is the minimum version you want your app to be able to be installed on. This is mostly dictated by the features you want to use. If you want features introduced in iOS 4, you need to set the deployment target to 4.0.
also, be careful that these are set identically for all configurations and don't vary between development and release.

Related

iOS deployment target set to iOS 4.2. Will the app run on devices running earlier versions of iOS?

If an app is compiled in Xcode with its iOS Deployment target set to iOS 4.2, will it run on devices running earlier versions of iOS? The app does not have features exclusive to iOS 4.
I did a clean install of Snow Leopard and XCode 3.2.5, and earlier versions of the SDK aren't there to test against.
No. The deployment target defines the minimum required verision of iOS the device must be running. You can set the build target so 3.1.3, for example, to support devices with iOS versions >= 3.1.3.
The Base SDK setting defines which SDK version your app is using. This will be 4.2. As long as you do not use any iOS 4 features, you can safely set the deployment target to 3.1.3.
No. The app will only run on the version set in the Deployment target and later versions, not earlier.
The deployment target needs to be set to the lowest version of iOS that you wish to support, eg. iOS 3.x.
I know you've stated it doesn't use any 4.x specific features. but just for completeness:
If you set your deployment target to a version older than the latest, you need to weak link new frameworks and test for the existence of classes/constants symbols before using them and fail-over if they don't exist.
No. It doesn't run. iOS can't know if your app will using features not available untill he launch it so you have to set this as a requirement.

Which iPhone SDK should I use?

I have little knowledge about how to make application to compatible to a device.
I have iPhone SDK 4.0 and want my app to run on iOS 2.0 or later.
I have read that set only the iPhone OS Deployment Target to 2.0 and use only those API methods which are common after 2.0.
Is it enough?
or do I have to use another (lower) SDK?
or do I have to do something more...?
You should always be developing with the latest SDK. You can set this in your project's properties under "Base SDK" in the "Architectures" section of your project's settings (right click on the project in the organizer, and go to "Get Info").
However, to make sure that your app runs on older devices, you would do this by setting the "iOS Deployment Target" to iOS 3.0 under the "Deployment" section of the project's settings.
For the record, I said version 3.0 above because that's the lowest possible supported version that I see in my Xcode. I don't think it's possible to target 2.0 devices anymore.
The newest Sdk. Apple may not accept the Sdk create by old Sdk.
You can target your min required version os for your App even you are using latest version Sdk.

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

Building/Testing a Universal iPhone/iPad application

I have a project configured (I think) to produce Universal binaries. The base SDK is set to 3.2 and the Deployment Target is set to 3.1. Target Device Family is iPhone/iPad and the architecture is armv6 armv7.
I had a few questions about how this Universal binary thing really works:
1) When I want to submit an app binary for review, what configuration should I set as the build target? If I set it as "Device - 3.1" I get a warning which says "warning: building with Targeted Device Family" that includes iPad('1,2') requires building with the 3.2 or later SDK". However, if I build with SDK 3.2, will it still run on iPhones with OS 3.1?
What's the right configuration for device and architecture (arm6/arm7)?
2) How do I test the scenario above (built with SDK 3.2, but installed on a device running OS 3.1)? If I build with SDK 3.2, when I try to install it on a phone with OS 3.1, I get an error saying that the phone's OS isn't updated.
Thanks!
Our first Universal App just got approved and released in the App Store today, so here are the settings we successfully used:
Architectures
Architectures: Optimized (armv6 armv7)
Base SDK: iPhone Device 3.2
Build Active Architecture Only: unchecked
Valid Architectures: (empty)
Deployment
Targeted Device Family: iPhone/iPad
iPhone OS Deployment Target: iPhone OS 3.0
(you can set this to any iPhone 3.x OS but we wanted to target the oldest devices possible. This must be 3.0 or above, 2.x is not valid for a Universal App.)
Make sure that you'd also checked these settings for the Target itself (Project->Edit Active Target "AppName"); my initial problems when uploading to iTunes Connect were because the iPhone OS Deployment Target for the Target itself was still set to 2.2.1.
So, the key seems to be that the "Architectures" setting be set to "Optimized (arm6 arm7)" in addition to the "Valid Architectures" setting being set to "armv6 armv7".
This allows it to compile with the 3.2 SDK and run on an iPhone running 3.1
The settings I have in my question, in addition to this above change, seems to be what's needed to configure the app for submission as a universal binary. I haven't done it yet, but I'm fairly confident.
Please correct me if I'm wrong.

Can a user install iphone application developed using 3.1.3 in his iphone 3.0?

Can a user install my application from iTunesStore if he is having iPhone OS 3.0 or having lower version of iPhone OS and I have developed my application using iPhone SDK 3.1.3...
Can anyone help me with this...
Thanx in advance...
In you projects settings, use a build setting named "iPhone OS Deployment Target" to specify your minimal iPhone OS version.
To do that, double click the blue project icon (at the top of the project’s "Groups and Files" table), click the "Build" tab and find the setting in the "Deployment" settings section.
To use features from a later iPhone OS, see this question.
If you compile your application to target iPhone OS 3.1.3 then it will not run on 3.0 - instead the user will get a message telling them to update their OS when they try to install.
However, there's a good chance that you will be able to compile your app to target 3.0 as long as you're not using any specific 3.1+ and newer features. To do so, just change the Active SDK you target in Xcode before you compile. Then your app will run on both 3.0 and 3.1.3
If you set your Target SDk in Xcode to 3.1.3, you may be using features of the SDK not found on an iPhone running a lower OS. However, you can test for those features in your program and take alternative measures if the user does not have those features/frameworks available. There is nothing that will prevent your app from running on older iPhone OSes, other than the fact that using new features will cause the app to fail.
On the other hand, you use the Deployment SDk value of XCode to limit which iPhone OSes can actually run your app. This way you can limit the app to be available to only iPhones with later OS and not the earlier ones. The Apple iTunes App Store will use the Deployment SDk value to tell the user who is purchasing, what the minimum system requirement is too.