How to require ARC in a class?

吃可爱长大的小学妹 提交于 2019-12-05 02:37:46

The following should work:

#if !__has_feature(objc_arc)
#  error Compile me with ARC, please!
#endif

Place it at the top of your file.

If it is a complete file, I would recommend adding -fno-objc-arc to the compiler flags to use the non-arc compiler.

Use the macro to compile "parts" of code with the non-arc compiler. for example, use this if you are writing a framework that will be used in both arc and non-arc code bases and write release, deallocs within this macro block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!