iOS:系统宏说明(持续更新)

来源:互联网 发布:华为账号中心无法数据 编辑:程序博客网 时间:2024/06/05 15:54

__OBJC__:

#ifdef __OBJC__    #import <UIKit/UIKit.h>    #import <Foundation/Foundation.h>#endif

It means the objective C compiler is being used. So you can create hybrid header files that can be used when compiling objective C or C or C++.
或者This would be the case if you were developing an objective-c / cocoa application. In other words, if you were developing a C++ / carbon application, the OBJC symbol would not be defined and those objective-c dependant frameworks would not be imported.

__has_feature:某些特性验证

#if !__has_feature(objc_arc)#error This library requires automatic reference counting#endif

NS_AVAILABLE_IOS(ios)

告诉在ios及以后的版本使用,更老版本不能使用;
类似:NS_AVAILABLE(_mac, _ios) 共用的方法

NS_DEPRECATED_IOS(_iosIntro,_iosDep, …)

_iosIntro表示方法引入时iOS版本,_iosDep表示方法废弃时iOS版本;第三个参数是message意思;
类似;NS_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep, …)
类似:__TVOS_PROHIBITED不可用或者__TVOS_UNAVAILABLE不可用或者__TVOS_AVAILABLE(_vers) 或者__TVOS_DEPRECATED(_start, _dep, _msg) 同样的 watchOS类似;

__IPHONE_OS_VERSION_MIN_REQUIRED

这个取值来源于deployment target;
__IPHONE_OS_VERSION_MAX_ALLOWEDQ取值来源于你的base sdk值;俩个值主要用在不同版本api适配上。

0 0
原创粉丝点击