__IPHONE_OS_VERSION_MIN_REQUIRED does not return the deployment target?

Why does __IPHONE_OS_VERSION_MIN_REQUIRED return a base SDK instead of a deployment target?

I want to use a class that can only work on iOS 4.3 and above, but still supports 4.0 and above. For this, I claim that if I try to use this class on devices with iOS version lower than 4.3. To avoid the assertion, I avoid the code inside the code by checking for methods 4.3. The installation target is currently set to 4.0.

However, since the statements will only be executed when the application is launched on the old device, I also want to add a warning if the deployment target is less than 4.3. I am trying to use __IPHONE_OS_VERSION_MIN_REQUIRED. However, this somehow returns 50000(the base SDK) instead of something below 43000, and I can't figure out why.

The code:

NSLog(@"Deployment target: %i", __IPHONE_OS_VERSION_MIN_REQUIRED); // Returns 50000 instead of 40000.
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 43000
// Never gets here
NSLog(@"%@", @"WARNING! NWMethodWrapper does not work on iOS versions below 4.3. If you insist on supporting older iOS versions, make sure you do not call NWMethodWrapper methods unless dlsym(RTLD_DEFAULT,\"imp_implementationWithBlock\") evaluates to true.");
#endif
NSAssert(dlsym(RTLD_DEFAULT,"imp_implementationWithBlock"), @"NWMethodWrapper uses methods that are only available from iOS 4.3 and later."); // Asserts, as appropriate (running on iOS 4.2.1).

Change: . The goal of my deployment is already set in 4.0, so I ask a question.

+3
source share
2 answers

, , , , , . , , , .

​​ 5.0 ( , 4.0), , __IPHONE_OS_VERSION_MIN_REQUIRED .

+3

__IPHONE_OS_VERSION_MIN_REQUIRED , __IPHONE_OS_VERSION_MIN_REQUIRED ( "AvailabilityInternal.h" ), , ​​ iphone OS, , ​​ - , iOS 5.0.

+3

All Articles