在编程过程中,我们会用到很多各种各样的他人封装的第三方代码,但是有很多第三方都是在非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.

具体操作步骤入下图:

ARC和非ARC文件混编

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

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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-15
  • 2021-05-31
  • 2022-12-23
  • 2021-11-29
  • 2021-08-28
相关资源
相似解决方案