How does an app with lower base sdk work?

前端 未结 7 1350
悲&欢浪女
悲&欢浪女 2021-01-05 08:24

In XCode I can specify Base SDK. I am wondering how does that work behind the scenes? If I am running an app, for example, on a device that has iOS 7 and my base SDK is iOS

7条回答
  •  长发绾君心
    2021-01-05 09:01

    You should set your target to ios 5.0 (via your project target settings) for making sure that none of the ios6 methods are used (or else a compilation error will prevent you from building it).

    In order to support new features and check if ios6 is available on the device you have two ways :

    During compilation (so you can still build your app with lower targets and newer together) use the following macro

    #if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0
     // Your ios6 code goes here
    #endif
    2: During runtime : [[[UIDevice currentDevice] systemVersion] floatValue] > 6.0
    

提交回复
热议问题