Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 879 Bytes

2020-11-03-ARC与MRC混合使用.md

File metadata and controls

35 lines (21 loc) · 879 Bytes
layout title subtitle date author header-img catalog tags
post
ARC 与 MRC 混合使用
MRC 库的处理
2020-11-03
BY
img/post-bg-cook.jpg
true
iOS

Xcode 项目中我们可以使用 ARC 和非 ARC 的混合模式。

有些时候我们工程中引用了十分古老的库为MRC模式,这时就需要采用混合模式进行处理

  • 如果你的项目使用的 MRC 模式,要为 ARC 模式的代码文件加入 -fobjc-arc 标签。

  • 如果你的项目使用的是 ARC 模式,要为 MRC 代码文件加入 -fno-objc-arc 标签

添加标签的方法:

打开:你的target -> Build Phases -> Compile Sources

双击对应的 *.m 文件

在弹出窗口中输入上面提到的标签 -fobjc-arc-fno-objc-arc 点击 done 保存