我可以将使用 ARC 的静态库链接到面向 iOS 3.2 的项目吗?
我正在制作静态库产品。我想使用 ARC,但我的一位客户希望将他们的应用程序定位到 iOS 3.2。他们还希望瞄准 ARMv6 架构。
好的。我必须接受这个要求。据我所知,没有weak
引用的ARC只是编译器功能,所以我认为静态库本身没有区别,或者它不需要iOS 4.0。但据我所知,Apple 将最低 iOS 限制为 4.0。所以我自己不能决定这个,因为我没有3.2设备:(
这里有人在iOS 3.2上测试过ARC代码吗?如果运行良好,我将过渡到ARC,并用ARC编译我的库,并将库传递给我的库我想我可以强迫他们使用 4.0,但我不确定 ARMv6 的来源,没有理由 ARMv6 无法工作,但我无法测试这一事实让我担心。关于你的经历。
I'm making a static library product. I want to use ARC but one of my customer want to target their app to iOS 3.2. They also want to target ARMv6 architecture.
OK. I have to accept the requirement. As I know, ARC without weak
reference is just compiler feature, so I think there's no difference in static library itself or it will not require iOS 4.0. But as I know, Apple limited minimum iOS as 4.0. So I cannot decide this myself, because I have no 3.2 device :(
Is here anyone who tested ARC code on iOS 3.2? If it runs well, I will transit to ARC, and compile my library with ARC, and pass the library to my customer. I think I can force them to use 4.0, but I'm not sure about ARMv6. Of source there is no reason ARMv6 will not work, but the fact that I cannot test makes me to worry. Please let me know about your experience.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自动引用计数需要现代运行时才能工作(存在于 iOS 4.0 和 64 位 Snow Leopard 中),因此启用 ARC 的项目无法以 iPhone OS 3.x 为目标。它们会在运行时失败。
将支持 ARC 的静态库部署到 iOS 4.x 有一个您应该注意的小问题。正如我在这个答案中所述,如果有人在非 ARC 应用程序中使用启用 ARC 的静态库,他们会如果他们将此应用程序定位于 iOS 4.x,则需要手动链接到
libarclite_iphoneos.a
库。默认情况下,它包含在启用 ARC 的应用程序中,但在链接到启用 ARC 的库的非 ARC 应用程序中将缺失。Automatic reference counting requires the modern runtime to work (present in iOS 4.0 and 64-bit Snow Leopard), so ARC-enabled projects cannot target iPhone OS 3.x. They will fail at runtime.
Deploying an ARC-enabled static library to iOS 4.x has one slight hitch that you should be aware of. As I describe in this answer, if someone uses your ARC-enabled static library within a non-ARC application, they'll need to manually link in the
libarclite_iphoneos.a
library if they target this application at iOS 4.x. This is included by default in ARC-enabled applications, but will be missing from non-ARC applications that link against ARC-enabled libraries.ARC 可用于 SDK 5.0 和 iOS 4.3 运行时
您可能需要查看 http://clang.llvm .org/docs/AutomaticReferenceCounting.html 了解详细信息
这篇文章中还有很多关于构建静态库的好信息:http://blog.stormyprods.com/2008/11 /using-static-libraries-with-iphone-sdk.html
ARC is availible with SDK 5.0 and iOS 4.3 runtime
You may want to check out http://clang.llvm.org/docs/AutomaticReferenceCounting.html for details
A lot of good info on building static libraries in this post also: http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html