run-time vs. compile-time iPhone version check

后端 未结 3 369
孤街浪徒
孤街浪徒 2020-12-16 20:45

What\'s the difference between run-time, e.g., [[UIDevice currentDevice] systemVersion], and compile-time, e.g., __IPHONE_OS_VERSION_MIN_REQUIRED c

相关标签:
3条回答
  • 2020-12-16 20:51

    __IPHONE_OS_VERSION_MIN_REQUIRED is indeed just a build setting, which you can use in the preprocessor to modify code before compilation. No, Apple doesn't compile your code for each iPhone. They can't, since you don't give them the code. You can use compile time checking to determine, for example, if you need to compile code to emulate a new feature in older OS versions. However, you use runtime version checking to determine whether you should use the built in or emulated version of that feature.

    For example, iAds were added in 4.0. You currently support 4.0 and later, but plan on adding support for 3.2 in the future. You make code to display other ads in older versions, using runtime checking to determine whether you should use iAds or other, but you don't want it to be in any releases until the rest of the application is ready for 3.2, since it will make your application larger. You use compile time checking so that the preprocessor leaves that code out of your releases. By using the minimum version macro, you can easily add the code to your release by changing the minimum version build setting.

    0 讨论(0)
  • 2020-12-16 21:12

    The Compile and Run time or programing words which will be used by the developer. So the best example of compile time is the writing time of the code like importing syntax and declaring properities and methods.and ARC is the compile time programing. And coming to RUNTime after writing the code by the developer is going to execute the program is called runtime. In this time the code will be compiled and will face run time errors like crashing programs and fourse closes unexpected behaviour of the program like that.

    Please find the below url For more details

    http://pc.net/helpcenter/answers/compile_time_vs_runtime

    0 讨论(0)
  • 2020-12-16 21:13

    Yes, __IPHONE_OS_VERSION_MIN_REQUIRED is just the value for "iOS Deployment Target" under "Build Settings." Make sure the correct target, not the project, is selected.

    And, __IPHONE_OS_VERSION_MAX_ALLOWED corresponds to the "Base SDK" build setting.

    0 讨论(0)
提交回复
热议问题