Friday, December 6, 2013

Precompiled in how to determine the version of iOS

For example, how to write code like this

# If OS_VERSION> 4
Code execution ....
# Endif
Reply:
if ([[[UIDevice currentDevice] systemVersion] floatValue]> = 5.0) ⋯ ⋯
Reply:
cited a floor ybh37 reply:
if ([[[UIDevice currentDevice] systemVersion] floatValue]> = 5.0) ⋯ ⋯


I am now using this method, and I still hope, can not use precompiled way to judge, rather than the procedure dynamic branch execution.
Reply:
# If __ IPHONE_OS_VERSION_MAX_ALLOWED> = __ IPHONE_5_0
/ / This code will only compile on versions> = iOS 5.0
# Endif
Reply:
/ / Obtain the list of proxies by running the autoconfiguration script
# If TARGET_OS_IPHONE |! | __ IPHONE_OS_VERSION_MIN_REQUIRED> __ IPHONE_2_2
CFErrorRef err2 = NULL;
NSArray * proxies = [(NSArray *) CFNetworkCopyProxiesForAutoConfigurationScript ((CFStringRef) script, (CFURLRef) theURL, & err2) autorelease];
if (err2) {
return nil;
}
# Else
NSArray * proxies = [(NSArray *) CFNetworkCopyProxiesForAutoConfigurationScript ((CFStringRef) script, (CFURLRef) theURL) autorelease];
# Endif
Reply:
There are a lot of system header file definitions
Reply:
Here is information about iphone device code:
http://blog.csdn.net/cxsjabcabc/article/details/7183021

The landlord said it should be conditional compilation, you need to use the maximum allowed version, etc. Macro
Reply:
The reply was deleted at 2012-01-15 11:02:59 moderator

Reply:
Precompiled before compilation, this time you can know how to run your program on which the device will do. . .

No comments:

Post a Comment