96

我已经围绕 Xcode 中的新 ENABLE_BITCODE 设置跟踪了几个线程,也尽可能多地尝试(承认我不是 xcode 专业人士)但仍然无法编译项目以在我的测试手机上使用?

我的应用程序在模拟器上运行良好,但我无法将其部署到我的 iPhone 上进行测试。在后一个上,我刚刚安装了 iOS 9 beta。

现在,这是我收到的错误消息。看来该设置不会影响 PARSE.com 库,这是我项目的一部分?如何让我的项目部署到我的手机上?感谢您的任何建议。

    Ld /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-  bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods/Parse.framework/Parse normal armv7
cd /Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -L/Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods -L/Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods/Parse -F/Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods -filelist /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Intermediates/Pods.build/Debug-iphoneos/Pods-Parse.build/Objects-normal/armv7/Parse.LinkFileList -install_name @rpath/Parse.framework/Parse -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=8.0 -dead_strip -fembed-bitcode-marker -ObjC -lParseLib -lz -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Accounts -weak_framework Social -ObjC -fobjc-arc -fobjc-link-runtime -framework AudioToolbox -framework Bolts -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework Foundation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Intermediates/Pods.build/Debug-iphoneos/Pods-Parse.build/Objects-normal/armv7/Parse_dependency_info.dat -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/graffiti-bnmizxueojwiqcbbnsvilljhosrw/Build/Products/Debug-iphoneos/Pods/Parse.framework/Parse

---
ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers
ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers
ld: '/Users/xxxxxx/Documents/DigitalTempusDev/graffiti/Pods/Parse/libParseLib.a(PFSQLiteDatabase.o)' does not contain 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. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
4

10 回答 10

135

您确定您已选择Enable Bitcode反对NO您正在使用的构建配置(例如DEBUG)吗?您可以在项目->目标->构建设置->搜索enable bitcode->设置NO中检查它DEBUG(记住在测试发布之前尝试更新库,也许它已经包含位码)。然后编辑方案->运行->检查你是否有DEBUG配置atm。

在此处输入图像描述

于 2015-07-22T13:01:35.363 回答
54

请注意,对于使用 CocoaPodsENABLE_BITCODE = NO的项目,您应该同时设置项目和 Pods 容器项目目标。

这个错误

Ld /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos/ParseTwitterUtils.framework/ParseTwitterUtils normal arm64
    cd /Users/maximveksler/Developer/ParseUI-iOS/Pods
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -L/Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos -L/Users/maximveksler/Developer/ParseUI-iOS/Pods/ParseTwitterUtils -F/Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos -filelist /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Intermediates/Pods.build/Debug-iphoneos/ParseTwitterUtils.build/Objects-normal/arm64/ParseTwitterUtils.LinkFileList -install_name @rpath/ParseTwitterUtils.framework/ParseTwitterUtils -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -fembed-bitcode-marker -ObjC -lParseTwitterUtilsLib -lsqlite3 -lz -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Accounts -weak_framework Social -fobjc-arc -fobjc-link-runtime -framework AudioToolbox -framework Bolts -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework Foundation -framework Parse -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -single_module -compatibility_version 1 -current_version 1.8.1 -Xlinker -dependency_info -Xlinker /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Intermediates/Pods.build/Debug-iphoneos/ParseTwitterUtils.build/Objects-normal/arm64/ParseTwitterUtils_dependency_info.dat -o /Users/maximveksler/Library/Developer/Xcode/DerivedData/ParseUI-gwtgmlgbpobjfjfjgkiwdahqveos/Build/Products/Debug-iphoneos/ParseTwitterUtils.framework/ParseTwitterUtils

ld: '/Users/maximveksler/Developer/ParseUI-iOS/Pods/ParseTwitterUtils/libParseTwitterUtilsLib.a(PFTwitterAuthenticationProvider.o)' does not contain 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. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

通过以下方式解决:

在此处输入图像描述

在此处输入图像描述

于 2015-08-23T14:42:40.533 回答
17

我在 Xcode7 中也遇到过同样的问题。解决方案:

  • PROJECT
  • 建造Settings
  • 选择All Tab
  • 输入搜索Enable Bitcode
  • Update FlagNo(将在您的项目下方(第二列))
于 2015-10-13T05:55:29.070 回答
16

我在使用 GoogleAnalytics 可可豆库时遇到了类似的问题,并且该库没有针对带有 iOS 8 的 iPhone 6 进行编译。

我的解决方案是在应用程序项目的目标中转向 NO“启用位码”标志 - 而不是在 Pods 项目中。

于 2015-09-21T10:08:08.533 回答
11

如果您的位码未显示,请选择全部。当 xcode 选择 Basic 时,您的 Bitcode 选项未显示。

在此处输入图像描述

当您选择 All 时,您可以看到 Bitcode。然后为广告配置设置否 在此处输入图像描述

于 2015-12-13T14:50:56.377 回答
10

我只是为我的项目设置它。

MyProjectTarget -> 构建设置 -> 启用 Bitcode = NO

于 2015-10-15T23:26:17.343 回答
5

正如大家所说,答案设置Enable BitcodeNo构建设置中,但我认为你们中的一些人可能有兴趣从命令行执行此操作。

我的 Xcode 项目是由 Unity 生成的,我不希望对 Xcode 项目设置进行任何手动干预。也许有更好的方法或工具可以编辑构建设置,就像PlistBuddy如何让您更新plist文件中的值一样。我不知道有任何工具可以为构建设置执行此操作,所以我使用的是sed

sed:基于正则表达式运行替换。

如何从命令行Enable Bitcode设置:No

在这里,我的项目名称是Unity-iPhone所以我从 Xcode 项目的根目录运行以下命令:

sed -i -e 's/ENABLE_BITCODE = YES;/ENABLE_BITCODE = NO;/g' \ 
Unity-iPhone.xcodeproj/project.pbxproj

-e -- 指定要运行的 sed 命令
-i -- 就地编辑文件,为每个文件单独运行脚本

-i如果您只想预览它的功能,请删除;)

请注意,您的所有构建配置都将使用此命令更改,该行在ENABLE_BITCODE = YES;我的project.pbxproj.

现在我的构建步骤可以完全自动化,因为fastlane会负责其余的工作!

于 2016-11-19T22:23:12.910 回答
3

如果您没有找到 enable_bitcode 标志。单击搜索栏旁边上方工具栏上的“全部”选项卡。 在此处输入图像描述

于 2016-03-31T07:50:11.853 回答
1

如果您无法在项目中更改 BITCODE 设置,请在终端中尝试此命令,

xcodebuild -target "target" -configuration "configuration" ENABLE_BITCODE=NO

于 2018-07-17T21:42:20.587 回答
0

如果您使用的是 Cocoapods,这将解决问题:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
于 2021-01-08T12:52:38.923 回答