【原】iOS学习之ARC和非ARC文件混编

 在编程过程中,我们会用到很多各种各样的他人封装的第三方代码,但是有很多第三方都是在非ARC情况下运行的,当你使用第三方编译时出现和下图类似的错误,就说明该第三方是非ARC的,需要进行一些配置。

解决方法:

苹果文档Transitioning to ARC Release Notes有一种解决办法为:

  Use Compiler Flags to Enable and Disable ARC

  You enable ARC using a new -fobjc-arc compiler flag. You can also choose to use ARC on a per-file basis if it’s more convenient for you to use manual reference counting for some files. For projects that employ ARC as the default approach, you can disable ARC for a specific file using a new-fno-objc-arc compiler flag for that file.

具体操作步骤入下图:

-fno-objc-arc 是非ARC文件在ARC环境下运行的编译器标志

-fobjc-arc 是ARC文件在非ARC环境下运行的编译器标志

 

posted @ 2016-05-20 20:58  墨隐于非  阅读(487)  评论(0编辑  收藏  举报