GoogleMapsSDK: architecture x86_64中未定义符号

27

我正在尝试安装Google地图SDK,但在运行时遇到了这个错误:

Undefined symbols for architecture x86_64:
  "_CBAdvertisementDataManufacturerDataKey", referenced from:
      -[GMSx_PEBeaconScanner centralManager:didDiscoverPeripheral:advertisementData:RSSI:] in GoogleMaps(PEBeaconScanner.o)
  "_CBAdvertisementDataServiceDataKey", referenced from:
      -[GMSx_PEBeaconScanner centralManager:didDiscoverPeripheral:advertisementData:RSSI:] in GoogleMaps(PEBeaconScanner.o)
  "_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
      -[GMSx_PEBeaconScanner scanIfAppropriate] in GoogleMaps(PEBeaconScanner.o)
  "_OBJC_CLASS_$_CBCentralManager", referenced from:
      objc-class-ref in GoogleMaps(PEBeaconScanner.o)
  "_OBJC_CLASS_$_CBUUID", referenced from:
      objc-class-ref in GoogleMaps(PEBeacon.o)
      objc-class-ref in GoogleMaps(PEBeaconScanner.o)
  "_vImageBoxConvolve_Planar8", referenced from:
      (anonymous namespace)::CreateBlurredImage(CGImage*, double, double) in GoogleMaps(GLWaterGroup.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
8个回答

46
我升级了一个使用较旧的Google地图SDK手动安装的应用程序时,注意到以下变化:
  • 需要在Build Phases -> Link Bundle with Libraries中链接CoreBluetooth.frameworkAccelerate.framework
  • "Other Linker Flags"下的-all_load标志会导致“duplicate symbol”错误。(改用-ObjC)

如果您使用CocoaPods方法进行安装(按照他们当前的说明),它应该能够处理所需的框架,但仍会因-all_load而混乱。


这个可以节省我很多时间,给它点赞。 - g212gs
为什么谷歌不能记录这个!谢谢我的朋友! - KamyFC

11

请确保包含以下内容:

GoogleMaps SDK 框架和 bundle

GoogleMaps (具有 .framework 扩展名) 存在于您的根目录中 (即 .xcodeproj 所在的位置)

GoogleMaps (具有 .bundle 扩展名) 在您的 xcode 项目中被引用

以下框架

Accelerate.framework

AVFoundation.framework

CoreBluetooth.framework

CoreData.framework

CoreGraphics.framework

CoreLocation.framework

CoreText.framework

GLKit.framework

ImageIO.framework

libc++.dylib

libicucore.dylib

libz.dylib

OpenGLES.framework

QuartzCore.framework

Security.framework

SystemConfiguration.framework

构建设置

您的项目设置中 Architecture 值 包括 armv7。

Other Linker Flags 中包含 -ObjC,如果未包含,请添加。


如果我不能使用-ObjC标志怎么办?我需要它来使用谷歌地图,但它会与解析框架发生冲突。有什么帮助吗?使用-force_load会导致符号重复... - SKYnine
这个答案解决了我的问题,问题出在使用了google maps IOS sdk 2.0.1的https://github.com/mapsplugin/cordova-plugin-googlemaps cordova插件(在撰写本文时)。 - Norman Breau

9
**_vImageBoxConvolve_Planar8, referenced from: (anonymous namespace)::CreateBlurredImage(CGImage*, double, double) in GoogleMaps(GLWaterGroup.o)**

This required "Accelerate.framework". So, please add it.

Steps:
1)Build Phases -> Link Bundle with Libraries.
2)Click "+",
3)Select "Accelerate.framework". Finish.

===================================

Others errors required "CoreBluetooth.framework. So, please add it also in similar way.

你让我的一天变得更美好,Arun +1。 - satheesh
如果你要从你的应用中删除谷歌地图,这也是一种解决方案,只需要执行“-”操作即可。 - Micah Montoya

5

2
谢谢Quentin。我刚做了这个,但不幸的是它又发送了一个错误:未定义架构x86_64的符号: “_vImageBoxConvolve_Planar8”,引用自: (匿名名称空间)::CreateBlurredImage(CGImage*,double,double)在GoogleMaps(GLWaterGroup.o)中 ld:符号(s)找不到架构x86_64 clang:错误:链接器命令失败,退出码1(使用-v查看调用) - STo
你需要按照这些指示来确保安装了所需的一切:https://developers.google.com/maps/documentation/ios/start - Quentin Hayot
1
在我看来,那些指示很糟糕,它们根本没有提到CoreBluetooth。 - funkybro
3
看起来_Accelerate.framework中提供了_vImageBoxConvolve_Planar8函数。我将其添加到我的项目中,问题就解决了,现在出现了“GoogleMaps.framework定义了706个重复的符号”的错误。 - funkybro
1
我和funkybro有同样的问题,现在我有706个重复项。不能使用Cocoa Pods(因为它会搞乱一切,或者-ObjC标志... - SKYnine
显示剩余2条评论

2
**_vImageBoxConvolve_Planar8, referenced from: (anonymous namespace)::CreateBlurredImage(CGImage*, double, double) in GoogleMaps(GLWaterGroup.o)**

This required "Accelerate.framework". So, please add it.

Steps:
1)Build Phases -> Link Bundle with Libraries.
2)Click "+",
3)Select "Accelerate.framework". Finish.

2

我遇到了同样的问题,在我的情况下,有2个GoogleMap.framework的引用,删除旧的框架引用后,问题得到了解决 :)

  • 点击项目
  • Build Phases中 -> 链接二进制文件 -> 检查是否存在GoogleMaps.framework的重复引用
  • 如果是,则删除一个未添加的引用。

谢谢!检查重复引用对我很有帮助! - Viktor Malyi

0

如果有人今天遇到这个问题,我在构建设置中链接CoreLocation.framework二进制文件解决了这个问题。


0

从(Targets->Build Settings->Other linker flag)中删除-all_load标志解决了我在使用CocoaPods时遇到的问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接