我可以构建一个ARC框架并将其用于非ARC项目中吗? [英] Could i build a ARC framework and use it in a non-ARC project?

查看:101
本文介绍了我可以构建一个ARC框架并将其用于非ARC项目中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为标题很好地解释了我的问题,目前我正在为我的个人需求开发一个小框架,并考虑使用ARC构建它(如果可能的话),并将其用于旧项目中在ARC之前建造?

解决方案

是的,有一点需要注意:如果您有iOS 4.x作为部署目标,则需要补充库在较旧的运行时上使用ARC编译的代码。对于使用ARC构建的应用程序,这与应用程序一起打包。如果您在非ARC应用程序中使用ARC编译的库,则不包括此功能。



您可以手动将此库链接到非ARC应用程序以避免运行时通过将 -fobjc-arc 添加到应用程序的其他链接程序标志,可以解决旧版操作系统版本中的问题。

请参阅这个苹果开发者论坛帖子有关此的更多讨论。


I think the title explains my question pretty well, I'm currently working on a small framework for my personal needs, and thought about building it with ARC (if thats possible at all?), and use it in old projects that were built before ARC?

解决方案

Yes, with one caveat: if you have iOS 4.x as a deployment target, a supplemental library is necessary to deal with ARC-compiled code on the older runtime. For an application built using ARC, this is packaged in with the application. This is not included if you are using an ARC-compiled library in a non-ARC application.

You can manually link this library into your non-ARC application to avoid runtime problems on the older OS versions by adding -fobjc-arc to your Other Linker Flags for the application.

See this Apple Developer Forums thread for some more discussion on this.

这篇关于我可以构建一个ARC框架并将其用于非ARC项目中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆