你的位置:首页 > 软件开发 > 操作系统 > error: retain is unavailable: not available in automatic reference counting. 解决办法

error: retain is unavailable: not available in automatic reference counting. 解决办法

发布时间:2017-08-15 12:00:08
报错原因是 项目使用的是ARC,但是有非ARC代码。 项目中要混合使用ARC和非ARC。 解决:target -> Build Phases -> Compile Sources双击报错的 *.m 文件在窗口中输入-fno-objc-arc   如果使用的非 ...

error: retain is unavailable: not available in automatic reference counting. 解决办法

报错原因是 项目使用的是ARC,但是有非ARC代码。 项目中要混合使用ARC和非ARC。

 

解决:

  1. target -> Build Phases -> Compile Sources
  2. 双击报错的 *.m 文件
  3. 在窗口中输入-fno-objc-arc

 

  如果使用的非 ARC ,则为 ARC 的代码加入 -fobjc-arc 

  如果使用的是 ARC ,则为非 ARC 代码加入 -fno-objc-arc 

 

判断项目是否用的ARC: 

error: retain is unavailable: not available in automatic reference counting. 解决办法

 

 

原标题:error: retain is unavailable: not available in automatic reference counting. 解决办法

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录