arm64 设备上的未定义符号 GMSPlacesClient

Undefined Symbol GMSPlacesClient on arm64 device

有与我要问的问题类似的问题,但它们针对的是 运行ning 在模拟器上,而不是在实际设备上。 当我尝试在我的设备上构建和 运行 我的应用程序时,出现错误

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_GMSPlacesClient", referenced from:
      objc-class-ref in BackendEngine.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

google places sdk for iOS Getting Started Page 指定使用来源和定位 pod,我已将其包含在我的 Podfile 中,如下所示:

target 'TestApp' do

  use_frameworks!
  
  #source 'https://github.com/CocoaPods/Specs.git'
  source 'https://cdn.cocoapods.org/'
  pod 'GooglePlaces', '4.2.0'
  
end

规范 GitHub link 未用作来源,因为每当我尝试 运行 它时,它会严重挂起并在某些命令上被阻止(如果我输入键盘中断,我总是得到相同的回溯:

Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
  $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git -- cocoapods
  Cloning into 'cocoapods'...
^C[!] Cancelled

[!] Automatically assigning platform `iOS` with version `14.4` on target `Cider` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Traceback (most recent call last):
    34: from /usr/local/bin/pod:23:in `<main>'
    33: from /usr/local/bin/pod:23:in `load'
    32: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
    31: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
    30: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    29: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
    28: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
    27: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
    26: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    25: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
    24: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
    23: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    22: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
    21: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    20: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
    19: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:177:in `sources'
    18: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:177:in `map'
    17: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
    16: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
    15: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:46:in `create_source_with_url'
    14: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:46:in `run'
    13: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    12: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:48:in `block in run'
    11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:82:in `clone_repo'
    10: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:41:in `with_changes'
     9: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:83:in `block in clone_repo'
     8: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:83:in `chdir'
     7: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/repo/add.rb:87:in `block (2 levels) in clone_repo'
     6: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:27:in `block in executable'
     5: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:67:in `execute_command'
     4: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:175:in `popen3'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:101:in `popen3'
     2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:219:in `popen_run'
     1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:180:in `block in popen3'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:180:in `value': Interrupt

我是 pods 的新手,如有任何帮助,我们将不胜感激!

  1. 你pod安装成功了吗?
  2. 我点播GooglePlaces成功,运行成功

我终于解决了!发生的事情是,在我的应用程序中,我的链接器标志缺少 GooglePlaces 和 GoogleMaps 依赖项的框架。我只是添加了

-framework "GoogleMapsBase" -framework "GooglePlaces"

到构建设置中的“其他链接器标志”选项。使用原始问题中描述的 pod 文件工作得很好。