【问题标题】:Objective-C ARC and Legacy Runtime compiling errorObjective-C ARC 和 Legacy Runtime 编译错误
【发布时间】:2013-02-19 07:27:53
【问题描述】:

我正在尝试使用 Xcode 4.6 编译源代码,用于 32 位架构,但收到此错误:

error: -fobjc-arc is not supported on platforms using the legacy runtime
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

怎么了?

【问题讨论】:

    标签: objective-c xcode compilation compiler-errors clang


    【解决方案1】:

    您将 ARC(自动引用计数)与不支持 ARC 的旧 Objective-C 1.0 运行时混合。

    OSX 上的 32 位应用程序自动使用 1.0 运行时,因此您必须为您的项目禁用 ARC,并使用手动引用计数。

    【讨论】:

    • 编译iOS应用时出现提示信息怎么办?
    • 您很有可能将您的 iOS 应用程序定位到不支持 ARC 的旧版 iOS。
    • 另外,Visual Source Safe 是魔鬼。
    • 我的 OSX 应用程序针对 64-bit Intel,但我仍然看到此错误。
    • 现在还是这样,ARC 只是 64 位吗?
    【解决方案2】:

    这个问题最近再次出现,因为 Xcode 5 删除了 ARCHS 参数 - 如果你允许的话。但是,如果您有一个使用 Xcode 4 的构建服务器,则默认为构建 32 位和 64 位,如果您启用了 ARC,则会失败。

    查看我的writeup 以获得更详细的说明。

    【讨论】:

      猜你喜欢
      • 2016-08-19
      • 1970-01-01
      • 1970-01-01
      • 2011-12-28
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多