Skip to content

Commit 097f50b

Browse files
committed
Add post
1 parent 5b91b0e commit 097f50b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
layout: post
3+
title: ARC 与 MRC 混合使用
4+
subtitle: MRC 库的处理
5+
date: 2020-11-03
6+
author: BY
7+
header-img: img/post-bg-cook.jpg
8+
catalog: true
9+
tags:
10+
- iOS
11+
---
12+
13+
14+
15+
## Xcode 项目中我们可以使用 ARC 和非 ARC 的混合模式。
16+
17+
> 有些时候我们工程中引用了十分古老的库为MRC模式,这时就需要采用混合模式进行处理
18+
19+
- 如果你的项目使用的 MRC 模式,要为 ARC 模式的代码文件加入 `-fobjc-arc` 标签。
20+
21+
22+
- 如果你的项目使用的是 ARC 模式,要为 MRC 代码文件加入 `-fno-objc-arc` 标签
23+
24+
添加标签的方法:
25+
26+
打开:你的`target -> Build Phases -> Compile Sources`
27+
28+
双击对应的 *.m 文件
29+
30+
在弹出窗口中输入上面提到的标签 `-fobjc-arc``-fno-objc-arc`
31+
点击 done 保存
32+
33+
![](https://ws3.sinaimg.cn/large/006tKfTcgy1fl3kvg0yp1j30pl0ahgov.jpg)
34+
35+

0 commit comments

Comments
 (0)