iPhone 4 iOS5 Core Plot 和 ARC 错误:“当前部署目标不支持弱引用”
我已将项目转换为 iOS 5 并启用了 ARC。现在我需要将核心情节与项目集成。当我尝试实例化 Core Plot 中包含的示例控制器时,我收到大约 20 个错误,如下所示:
当前部署目标不支持自动__weak引用
我已在构建设置中控制器名称旁边明确指出 fno-objc-arc
。
在启用 ARC 的情况下运行核心图还需要什么?
谢谢你!
I've converted my project to iOS 5 and enabled ARC. Now I need to integrate core plot with the project. When I try to instantiate a sample controller included with the Core Plot, I get about 20 errors as follows:
The current deployment target does not support automated __weak references
I've explicitly said fno-objc-arc
next to the controller's name in the build settings.
What else do I need to run core plot with ARC enabled?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
__weak
引用仅适用于 iOS 5 及更高版本。如果您将部署目标设置为之前的任何值,那么您将收到错误消息。基本上,如果您想部署到早期设备,则不能使用自动__weak
引用。替代品是__unsafe_unretained
__weak
references only work on iOS 5 and above. If you have the deployment target set to anything earlier, then you'll get the error. Basically, if you want to deploy to earlier devices you can't use automated__weak
references. The substitute would be__unsafe_unretained
虽然 Inspire48 的回答大致涵盖了 5.0 之前的 iOS 版本不支持 __weak 引用的事实,但这个特殊问题是由于 Core Plot 的标头未完全兼容 ARC 造成的。
几个月前,这个问题已在 Mercurial 存储库中修复,因此如果您想在启用 ARC 的项目中使用 Core Plot,则需要从存储库获取最新代码。 0.9 快照与 ARC 的交互效果不佳,因为其标头中存在类似这样的内容。
存储库中的 Core Plot 框架代码还支持在应用程序中启用 ARC 的情况下定位回 iOS 4.0 和 Snow Leopard(我相信 3.0 和没有 ARC 的 Leopard 也一样),因此您不需要定位 5.0 来使用 ARC核心情节。
While Inspire48's answer broadly covers the fact that
__weak
references are not supported in versions of iOS earlier than 5.0, this particular problem was due to Core Plot's headers not being made completely ARC compatible.This was fixed in the Mercurial repository a few months ago, so if you want to use Core Plot within an ARC-enabled project, you need to grab the latest code from the repository. The 0.9 snapshot does not interact well with ARC because of items like this in its headers.
The Core Plot framework code in the repository also supports targeting back to iOS 4.0 and Snow Leopard with ARC enabled in your application (I believe 3.0 and Leopard without ARC, as well), so you don't need to target 5.0 to use ARC with Core Plot.
变革发展目标6.0。
选择您的项目>目标>发展目标>>改为6.0
Change Development Targert 6.0.
Select Your Project > target > development target > change to 6.0