Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an iPhone app compatible with multiple SDK (firmware) versions

With iOS 4 coming out soon, I have already planned to include an iAd in a future update of an app of mine. I assume that this will make my app unusable for anyone on a firmware lower than 4.0. Is there a way to change those variables and the .xib file based on the user's firmware?

like image 904
Dyldo42 Avatar asked Jun 12 '10 01:06

Dyldo42


People also ask

Which SDK is used for iOS?

The central component of the iOS SDK is Xcode, Apple's interactive development environment (IDE). Xcode facilitates building apps for OS X, iOS and WatchOS. Xcode includes the interface, the LLVM compiler, instruments and iOS simulator tools that make development and testing possible without an Apple device.

Does Xcode have iOS SDK?

Xcode. Download Xcode 14, which incudes the latest SDKs for iOS, iPadOS, macOS, tvOS, and watchOS.

How do I find my iOS SDK version?

If you care about the build number (like "10B61"), especially during betas, the best place to check which version of Xcode and related SDKs you have installed is to use "System Information". Once there, you'll see version and build numbers for all of the major components of the Developer Tools.


1 Answers

Yes, you can build with the latest SDK (ie: 5.1) and still run on devices with earlier versions of the firmware (SDK).

  • Set your Deployment Target to the earliest version you want to be able to run with, ie: 3.0.
  • You set your Base SDK to the latest version that you are compiling with, ie: 5.0. This way you can reference the newer definitions and symbols in your code. This article "SDK and Deployment Targets" discusses Deployment vs Base SDK in detail.
  • Weak link to the libraries/frameworks with symbols that are only available in the newer iOS. This is so your app will run on a device that doesn't have the newer symbols.
  • You must check to see that a newer method is available before calling it. You have to make sure not to call a method that is 5.0 or 4.X only when your app is on a < 4.0 device. Of course you have to gracefully handle working on older versions by either using older methods or not supporting particular features that need newer SDK support.
  • NEW w/XCode 4.2: To support older devices you need to add armv6 to the build architectures and remove armv7 from the plist of required device capabilities.

See these SO questions and answers for more details:

  • deployment target vs base/active sdk
  • recommended way to support backward compatibility
  • How do you optionally use iPhone 3.0 features in a 2.0 compatible app
  • iPhone dev weak link framework
  • weak linking with IB
  • universal iphone/ipad app compilation error
  • iphone apps should include armv6
like image 151
progrmr Avatar answered Sep 23 '22 04:09

progrmr