ChatGPT解决这个技术问题 Extra ChatGPT

Xcode 7 和 ENABLE_BITCODE=YES 设置不起作用

我已经围绕 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)
您确定针对您正在使用的构建配置(例如 DEBUG)选择了 Enable BitcodeNO?您可以在项目->目标->构建设置->中查看。在 DEBUG 中搜索 enable bitcode->set NO(记住在测试发布之前尝试更新库,也许它已经包含位码)。然后 Edit Scheme -> Run ->检查您是否有 DEBUG 配置 atm。
出色地!是和不是。我没有在 POD 目标上设置它,这是我的疏忽。你的提示让我到了那里。谢谢
很高兴听到它:) 将其作为答案发布,因为它可能对其他人有用。
为什么我们需要更改 Bitcode?以前我们不需要更新它的值。有什么合乎逻辑的理由吗?谢谢
做了这一切,但应用程序仍然在设备上崩溃并出现相同的错误。我正在使用 iOS 9.1。请帮忙!

Z
Zorayr

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

https://i.stack.imgur.com/BGTkB.png


@Zorayr 正如您在我的帖子中添加的图片:您应该首先检查您的应用程序构建设置并在应用程序构建设置中更改此标志。只有当它没有帮助时,才对 Pod 做同样的事情。
如果将 Enable Bitcode 设置为 NO,应用程序是否会在 App Store 中被接受?
@NeAS 是的。目前,不需要启用位码。
M
Maxim Veksler

请注意,对于使用 CocoaPods 的项目,您应该在项目和 Pods 容器项目目标上设置 ENABLE_BITCODE = NO

这个错误

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)

通过以下方式解决:

https://i.stack.imgur.com/KlEj3.png

https://i.stack.imgur.com/K3189.png


如果我们使用选项 Enable Bitcode = NO 提交应用程序,Apple 会拒绝应用程序吗?
@G.Ganesh 请作为单独的问题发布。政策在 tvOS 和 watchOS 之间有所不同,答案是肯定的。 iOS 的答案目前是否定的,未来是肯定的。
@GaneshGuturi 目前是的,但苹果可能会在未来的某个时候削减它。更多解释,例如:stackoverflow.com/a/31207170/849616
S
Stefan Stoichev

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

去项目

构建设置

选择所有选项卡

输入搜索启用位码

将标志更新为否(将在您的项目下方(第二列))


A
ArturOlszak

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

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


这就是我在对我的回答的评论中所说的。要尝试在项目设置上执行此操作,当且仅当这不起作用时才切换到 pod 项目。
切换目标和项目以构建设置位码 NO 不适用于 ARCHIVING。是否可以为 Sim 构建找到工作。 XCODE 7.0.1
e
ethemsulan

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

https://i.stack.imgur.com/M5qn7.png

https://i.stack.imgur.com/TKmWL.png


A
Alexander

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

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


应用商店中的申请会被拒绝吗?
G
GabLeRoux

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

我的 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 中出现了 6 次。

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


h
haroon jamil

https://i.stack.imgur.com/JjdaZ.png


请添加一些代码以更好地解释您的答案。
J
Jaxs_ios

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

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


H
Hugo Jordao

如果您使用的是 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

关注公众号,不定期副业成功案例分享
关注公众号

不定期副业成功案例分享

领先一步获取最新的外包任务吗?

立即订阅