Code adaption for different iOS versions: _ IPHONE_ OS _VERSION_MAX_ALLOWED and _ IPHONE_8_0. 360os adaption Models

Source: Internet
Author: User

Code adaption for different iOS versions: _ IPHONE_ OS _VERSION_MAX_ALLOWED and _ IPHONE_8_0. 360os adaption Models

Currently, developers only want the lowest version to support ios8. ios8. after iOS9 and iOS10 are released, some new APIs and Some APIs are discarded. To ensure compatibility, sometimes the Code must be written to determine different iOS versions, or only the specified iOS version can be compiled or executed.

You need to use the following methods ):

Example:

// Use this method after ios8.0 to replace willRotateToInterfaceOrientation: duration: This method # if _ IPHONE_ OS _VERSION_MAX_ALLOWED> = 80000 // The View Controller is rotated to a certain size-(void) viewWillTransitionToSize) size withTransitionCoordinator :( id <UIViewControllerTransitionCoordinator>) coordinator {[super viewWillTransitionToSize: size withTransitionCoordinator: coordinator]; if (size. height> size. width) {NSLog (@ "------- the current device direction is landscape screen -------");} else {NSLog (@ "------- the current device direction is landscape screen -------");} # endif

 

_ IPHONE_ OS _VERSION_MIN_REQUIRED: Minimum iOS version requirements

_ IPHONE_ OS _VERSION_MAX_ALLOWED: Maximum iOS version allowed

 

# Definely _ MAC_10_0 1000

# Define _ MAC_10_1 1010

# Define _ MAC_10_2 1020

# Define _ MAC_10_3 1030

# Define _ MAC_10_4 1040

# Depin__ MAC_10_5 1050

# Depin__ MAC_10_6 1060

# Define _ MAC_10_7 1070

# Define _ MAC_10_8 1080

# Depin__ MAC_10_9 1090

# Define _ MAC_10_10 101000

# Define _ MAC_10_10_2 101002

# Definely _ MAC_10_10_3 101003

# Define _ MAC_10_11 101100

# Define _ MAC_10_11_2 101102

# Define _ MAC_10_11_3 101103

# Define _ MAC_10_11_4 101104

# Depin__ MAC_10_12 101200

/* _ MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */

 

# Define _ IPHONE_2_0 20000

# Define _ IPHONE_2_1 20100

# Define _ IPHONE_2_2 20200

# Define _ IPHONE_3_0 30000

# Define _ IPHONE_3_1 30100

# Define _ IPHONE_3_2 30200

# Define _ IPHONE_4_0 40000

# Define _ IPHONE_4_1 40100

# Define _ IPHONE_4_2 40200

# Define _ IPHONE_4_3 40300

# Definely _ IPHONE_5_0 50000

# Define _ IPHONE_5_1 50100

# Definely _ IPHONE_6_0 60000

# Define _ IPHONE_6_1 60100

# Depin__ IPHONE_7_0 70000

# Define _ IPHONE_7_1 70100

# Definely _ IPHONE_8_0 80000

# Define _ IPHONE_8_1 80100

# Define _ IPHONE_8_2 80200

# Define _ IPHONE_8_3 80300

# Define _ IPHONE_8_4 80400

# Define _ IPHONE_9_0 90000

# Define _ IPHONE_9_1 90100

# Define _ IPHONE_9_2 90200

# Define _ IPHONE_9_3 90300

# Definely _ IPHONE_10_0 100000

/* _ IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */

 

# Define _ TVOS_9_0 90000

# Define _ TVOS_9_1 90100

# Define _ TVOS_9_2 90200

# Define _ TVOS_10_0 100000

 

# Define _ watchos_00000 10000

# Define _ WATCHOS_2_0 20000

# Define _ WATCHOS_3_0 30000

  

You can press the Command key in Xcode and click to view more official macros.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.