Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 iOS 重构库,我想使用和不使用 ARC 编译选项。有没有办法在编译期间检测,比如#ifdefARC 是否可用?
#ifdef
是的,您可以使用以下内容:
#if __has_feature(objc_arc) ... #endif
即使您使用的是最新版本的 LLVM,也只有在使用该-fobjc-arc选项进行编译时才会评估为 true。
-fobjc-arc