Xcode Google Maps SDK 的 7 个链接器问题

Xcode 7 linker issue with Google Maps SDK

我刚刚下载了 Xcode 7 beta 4 并正在尝试构建我的 Swift 2.0 应用程序,但出现以下错误,我无法找出解决方案:

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: 'path/Pods/GoogleMaps/Frameworks/GoogleMaps.framework/GoogleMaps(GMSBillingPointRecorder.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)

有谁知道如何解决这个问题?

我将 ENABLE_BITCODE 标志更改为否并正确编译感谢@Visput 的回答

ENABLE_BITCODE 标记设置为 NO 可以解决问题。

对于那些想知道禁用它是否安全的人。 是的。

根据 Apple 文档

Bitcode (iOS, watchOS)

Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.

Xcode hides symbols generated during build time by default, so they are not readable by Apple. Only if you choose to include symbols when uploading your app to iTunes Connect would the symbols be sent to Apple. You must include symbols to receive crash reports from Apple.

Note: For iOS apps, bitcode is the default, but optional. If you provide bitcode, all apps and frameworks in the app bundle need to include bitcode. For watchOS apps, bitcode is required.

Bitcode 是 Apple 为 App 瘦身所做的新努力的一部分。在撰写本文时,它是可选的,但以后可能需要。我认为 Apple 正在给 frameworks/libs 社区时间来适应。

编辑: 在 Xcode 7 中,您将应用程序上传到 iTunes connect,处于称为 Bitcode 的中间状态。当用户下载您的应用程序时,App Store 将自动生成您的应用程序的优化版本(即 64 位,如果需要)以匹配用户正在使用的设备。

目前我们能做的就是禁用位码并等待 Google Maps SDK 的更新。

更新

SDK 1.11.0 - 现在支持 Bitcode

https://developers.google.com/maps/documentation/ios-sdk/releases?hl=en

资源:

https://developer.apple.com/library/prerelease/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html

https://www.hackingwithswift.com/ios9

只是要清楚在哪里禁用位码: 目标 -> 构建设置 -> 启用位码 -> 否

GIF 图片由@stevechen 提供

Google 已在 SDK 版本 1.11.0 - 2015 年 12 月解决此问题。请参阅 release notes:

Bitcode 现在包含在所有设备架构的 SDK 二进制文件中。 (Issue 8219).