XCode Not Deploying to iOS 4.2/iPhone 3G and 3Gs | How to Build for an older iOS Version

I wanted to make an app available to iOS devices that run on 4.2 and had made all the necessary settings regarding the build.

Even though everything seemed right, it still wouldn’t deploy to my test device, an iPhone 3G with iOS 4.2 on it. What happens is that XCode successfully builds the app, signs the build with a valid certificate, then shows “Running App on device” for a few seconds and then suddenly says “Finished running App on device”. It doesn’t even copy the app onto the device.

After some digging I knew why. While iPhone 4 and 4S have a processor chip architecture called armv7, iPhone 3G and 3GS still run on the old chip, the armv6 architecture chip.

When you create an iOS Project with an newer version of XCode using iOS 4.3 and higher, the build settings often configure automatically to support armv7, but not armv6.

In order to deploy, you first need to configure the build settings.

In the project explorer, click the project. This takes you to the view with the build settings. Again click the project and edit the build settings. Under “Architecture” remove armv7 and add armv6 armv7 just as you see it, separated by a space. If you have a row called “Valid Architectures” make sure it is set to armv6 armv7 as well. Now set the “iOS Deployment Target” to the iOS version that should be the minimum one (I used 4.3 in this case).

 

Don’t worry about the Base SDK, if it’s set to a higher iOS version. Keep in mind though that if you’re deploying for e.g. iOS 4.3, you need to make sure that you’re not using features available only in the higher iOS versions. You can handle this by always checking device capabilities (e.g. has camera etc.) and by using the respondsToSelector method. It’s recommended that you don’t go through querying the iOS version itself and deciding upon that.

 

Next, also check the build settings for the target. If there’s anything referring to Architecture, set it to armv6 armv7, if there isn’t, just leave it as it is. If there’s an entry for the “iOS Deplyment Target” set it to the same value as before (4.3 in my case).

 

 

Next, you need to check your info.plist file. You may find (or have set your own)  required device capabilities. This can be that it has a camera, a GPS sensor, accelerometer etc. Sometimes XCode will add a line that has the value “armv7”. But you also want to be able to deploy to armv6! If that’s the only device capability that’s being checked for, remove the entire “Required device capabilities” entry, otherwise only the sub-entry refering to armv7.

If you’ll try to deploy, now it should work. This can also explain potential problems of users installing your app via either the AppStore or some kind of deployment server/service, e.g. TestFlight.

In some cases, if all these settings are correct, verify all the other device capabilities you might be using and see what happens if you play around with them.

Good luck!