Check for ARC in precompile

前端 未结 1 842
自闭症患者
自闭症患者 2020-12-13 06:33

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

1条回答
  •  醉梦人生
    2020-12-13 07:13

    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.

    0 讨论(0)
提交回复
热议问题