如何在Xcode7中ENABLE_BITCODE?

How to ENABLE_BITCODE in Xcode 7?

我正在使用 parse.com 进行开发,但在升级到 Xcode 7 时遇到了这个问题。一些解析框架无法正常工作。

我收到此警告:

URGENT: all bitcode will be dropped because '/Users/[MY_USER]/Downloads/parse-starter-project-1/ParseStarterProject/Parse.framework/Parse(PFMutableFileState.o)' was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. Note: This will be an error in the future.

提醒一下,在 Xcode 6.

的最新版本中一切正常

如何在 Xcode 7 中启用位码?

这将是 Parse 必须做的事情,当为您的应用程序启用位码时,您的捆绑包中的所有应用程序和框架都需要包含位码(请参阅 here)。如您所见,Parse 框架目前还没有使用它,这是可以理解的,因为它仍处于测试阶段,尚未准备好迎接黄金时段。

这似乎是 Xcode 7 beta 3 中的一个错误。如果您使用的 Cocoapod 不是在 ENABLE_BITCODE 开启的情况下构建的,您可以尝试通过以下方式完全禁用它将以下内容添加到 Podfile 的底部:

post_install do |installer|

  installer.pods_project.targets.each do |target|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end

    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

警告:根据我的阅读,您不能在 ENABLE_BITCODE 未打开的情况下提交 WatchKit 应用程序,因此这是一个权衡,直到 Parse 更新他们的 pods.

如果您使用的是为 iOS 9 更新的第三方框架或库,并且您不想包含位码,那么您应该检查该框架的版本是否是不提供 bitcode。请参阅 Apple's note 了解何时将其包含在您的应用程序包中:

For iOS apps, bitcode is the default, but optional. For watchOS and tvOS apps, bitcode is required. If you provide bitcode, all apps and frameworks in the app bundle (all targets in the project) need to include bitcode.

为了 disable/enable bitcode 在您的项目中,请按照以下步骤操作:

  1. 在项目构建设置中,确保您已启用所有设置可见。
  2. 构建选项在第 4 部分以下。 Select Enable Bitcode 选项是或否。

只需在构建设置中搜索 bitcode 并将其设置为 false/NO

您有多种选择

  • Enable Bitcode (ENABLE_BITCODE)
  • Other C Flags(OTHER_CFLAGS)-fembed-bitcode
  • 使用 bitcode
  • 创建用户定义的设置 BITCODE_GENERATION_MODE