What is difference between these 2 macros?

前端 未结 1 434
青春惊慌失措
青春惊慌失措 2021-02-04 13:20

What is the difference between

__IPHONE_OS_VERSION_MAX_ALLOWED

and

__IPHONE_OS_VERSION_MIN_REQUIRED

相关标签:
1条回答
  • 2021-02-04 13:45

    __IPHONE_OS_VERSION_MIN_REQUIRED is set to the Deployment target, which represents the version the user must minimally run to install your app. __IPHONE_OS_VERSION_MAX_ALLOWED is set to the SDK version you're compiling against, although that doesn't mean your app won't run on newer versions though, but you can use it to check whether some OS features are available.

    For instance, since iOS 3.2 we have the UIBezierPath class. If you're compiling against SDK 3.1 (to test it in the iPhone Simulator presumably), this new class is not available so the compiler will give you a warning that the class doesn't exist. Fair enough, but we don't want to comment that specific code every time we build it against the older SDK, just for a simulator test. We just want to hide these blocks of code and that's made possible by those macro's.

    Please read this article on Cocoa with Love for further explanation, tips and tricks.

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