iOS 4 compatibility

When creating a new project, the minimum iOS version that it is going to support depends on which Xcode version you are using. As for Xcode 4.4.1, the default deployment target is iOS 5.1.

The number of devices running versions of iOS prior to 5.x is very low (see a real world application stats here), but If you are willing to support the wider range of devices, you should enable your application for iOS 4.2.1 (that is the maximum version supported by 2nd gen iPod).

  1. Open your project with Xcode.
  2. Go to Project > Summary and change Deployment Target to 4.2.
  3. Go to Project > Build Settings and add armv6 to Valid Architectures.
  4. Go to your Info.plist File and remove the item armv7 from the Required device capabilities row.

After performing this 3 changes your application should be able to run in any device running iOS 4.2 or greater.

When running your application for the first time on an iOS 4.x device, it is most likely going to crash or, at least, behave abnormally. This is because the SDK you compiled it with is newer than the one supported by the device. Some classes or methods may be not be available in the device or may have a slightly different result. So, the bad news are that you are required to test your application in every major version of iOS supported by your application.

The most common problem that arises when developing a for an older deployment target than the SDK you have installed is the unrecognized selector exception. When possible, the recommended pattern to check APIs availability is to use the respondsToSelector: method, instead of explicitly checking iOS version. To know when it is necessary to perform this compatibility check, you can refer to Xcode’s Quick Help:

Related Posts

Data Persistence in iOS Applications

Fragments

Sharing Services

A Hack@home Event
Powered by AppCircus

Our Sponsors/Partners Egypt Innovate google orange vodafone TA-Telecom Microsoft

Our partners aleshanek ya balady arabnetdotopen gdg-cairo Green Arm Bey2ollak World Bank itida - Developing IT in Egypt Ministry