Manuel
Manuel

Reputation: 15042

How to know which API cannot be used in which iOS SDK?

An Xcode project has the following settings:

As I understood it, the app can be installed on iOS 9.0 and possibly try to access an API that is only available since iOS 9.3. In that case the app would crash.

So how do I easily find out which APIs that are accessed by the app are not available in any version between the deployment target and the version previous to the base SDK? Since the deployment target is known to the compiler, shouldn't it issue a warning when an API is used in code that will obviously crash the app when run on an iOS version below it's introduction?

Upvotes: 1

Views: 220

Answers (2)

Jim Tierney
Jim Tierney

Reputation: 4105

You should check the class ('NewFeature', being any 9.3 feature class that you're calling that is)

if ([NewFeature class]){
   //then use it if available
   //The code will land here if it is available to the OS the device is using
}else{
   //use older alternative way
}

Upvotes: 0

gnasher729
gnasher729

Reputation: 52530

You check this in the header files.

The API doesn't change between iOS 9 and iOS 9.3, so you are safe. On the other hand, people using iOS 8 can't run your app which means fewer users, fewer sales, less money.

If you deployed on 8.0, you could easily verify at compile time whether you use some new APIs by temporarily changing the base SDK to 8.0. In that case, you would have to make sure not to call any iOS 9 methods on iOS 8.

Upvotes: 2

Related Questions