iOS开发中的高版本宏检测

在框架开发中,为了适配最低的系统版本,我们需要注意不使用高版本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 */

 

转载于:https://www.cnblogs.com/hushuai-ios/p/5146792.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值