iOS開發中的高版本宏檢測

來源:互聯網
上載者:User

標籤:

在架構開發中,為了適配最低的系統版本,我們需要注意不使用高版本API。但除了個人注意之外,是否可以在編譯時間由系統提示超出相容版本的API使用方式呢,

觀察了CF_AVAILABLE_IOS宏之後,我們給出了如下解決方案,即更改iOS SDK。具體方案如下:

添加位置: Frameworks-> CoreFoundation -> CFAvalailability.h line 115  添加代碼:

/* added by Mitty */

 

#define __NEP_2_0 availability(ios,introduced=2.0)

#define __NEP_2_1 availability(ios,introduced=2.1)

#define __NEP_2_2 availability(ios,introduced=2.2)

#define __NEP_3_0 availability(ios,introduced=3.0)

#define __NEP_3_1 availability(ios,introduced=3.1)

#define __NEP_3_2 availability(ios,introduced=3.2)

#define __NEP_4_0 availability(ios,introduced=4.0)

#define __NEP_4_1 availability(ios,introduced=4.1)

#define __NEP_4_2 availability(ios,introduced=4.2)

#define __NEP_4_3 availability(ios,introduced=4.3)

#define __NEP_5_0 availability(ios,introduced=5.0)

#define __NEP_5_1 availability(ios,introduced=5.1)

#define __NEP_6_0 availability(ios,introduced=6.0)

#define __NEP_6_1 deprecated("API version newer than iOS6.0")

#define __NEP_7_0 deprecated("API version newer than iOS6.0")

#define __NEP_7_1 deprecated("API version newer than iOS6.0")

#define __NEP_8_0 deprecated("API version newer than iOS6.0")

#define __NEP_8_1 deprecated("API version newer than iOS6.0")

#define __NEP_8_2 deprecated("API version newer than iOS6.0")

#define __NEP_8_3 deprecated("API version newer than iOS6.0")

#define __NEP_9_0 deprecated("API version newer than iOS6.0")

#define __NEP_9_1 deprecated("API version newer than iOS6.0")

#define __NEP_10_0 deprecated("API version newer than iOS6.0")

#define __NEP_10_1 deprecated("API version newer than iOS6.0")

#define __NEP_10_2 deprecated("API version newer than iOS6.0")

#define __NEP_10_3 deprecated("API version newer than iOS6.0")

#define __NEP_10_4 deprecated("API version newer than iOS6.0")

#define __NEP_10_5 deprecated("API version newer than iOS6.0")

#define __NEP_10_6 deprecated("API version newer than iOS6.0")

#define __NEP_10_7 deprecated("API version newer than iOS6.0")

#define __NEP_10_8 deprecated("API version newer than iOS6.0")

#define __NEP_10_9 deprecated("API version newer than iOS6.0")

#define __NEP_10_10 deprecated("API version newer than iOS6.0")

 

 

#define CF_AVAILABLE_IOS(_ios) \

__attribute__((,__NEP_##_ios))

 

/* added by Mitty End */

 

iOS開發中的高版本宏檢測

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.