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

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

问题描述

我认为标题很好地解释了我的问题,我目前正在开发一个满足我个人需求的小型框架,并考虑使用 ARC 构建它(如果可能的话?),并将其用于旧项目中是在 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?

推荐答案

是的,有一个警告:如果您将 iOS 4.x 作为部署目标,则需要一个补充库来处理旧版本上的 ARC 编译代码运行.对于使用 ARC 构建的应用程序,它与应用程序一起打包.如果您在非 ARC 应用程序中使用 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.

您可以手动将此库链接到您的非 ARC 应用程序,以避免在旧操作系统版本上出现运行时问题,方法是在应用程序的其他链接器标志中添加 -fobjc-arc.

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.

请参阅此 Apple 开发者论坛主题,了解更多关于此的讨论.

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

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

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