7

iOS开发小记:ARC与非ARC工程互相调用

 1 year ago
source link: https://www.isaced.com/post-187.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

iOS开发小记:ARC与非ARC工程互相调用

无意在CSDN某博客上看到这样一篇日志,果断收藏下来,原帖找不到了。前段时间在网上下下Demo来看,想自己引用到工程里,结果就引起ARC与非ARC的冲突,于是把原Demo的Code全部去掉ARC特性,这样做既麻烦又容易出错,不是一个好办法。

在ARC项目中使用非ARC框架,在非ARC项目中使用ARC框架

在ARC项目中使用非ARC的框架解决方案:

在target里的build phases中,找到compile sources,把涉及到非ARC的类,后面加上: -fno-objc-arc

在非ARC的项目中加入ARC类库:

如何在未使用arc的工程中引入一个使用了arc特性的文件:对相应的文件添加: -fobjc-arc

如果一个非 arc 类 引用一个arc类  该怎么使用就怎么使用,该怎么释放就怎么释放~


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK