在预编译中检查ARC [英] Check for ARC in precompile

查看:74
本文介绍了在预编译中检查ARC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要使用的iOS重构库,而没有ARC编译选项.有没有一种方法可以在编译期间进行检测,例如使用#ifdef来检测ARC是否可用?

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?

推荐答案

是的,您可以使用以下内容:

Yes, you can use the following:

#if __has_feature(objc_arc)
  ...
#endif

即使您使用的是最新版本的LLVM,也只有在使用-fobjc-arc选项进行编译时,此评估结果才为true.

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.

这篇关于在预编译中检查ARC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆