I have an iOS refactoring library that I want to work with and without the ARC compilation option. Is there a way to detect during compilation, like with an #ifdef
, if ARC is available?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, you can use the following:
#if __has_feature(objc_arc)
...
#endif
Even if you're using the latest version of LLVM, this will only evaluate to true if you're compiling with the -fobjc-arc
option.