arm64 设备上未定义的符号 GMSPlacesClient

问题描述

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

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)

谷歌将 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 链接不用作源,因为每当我尝试运行它时,它都会明显挂起并在某些命令上被阻止(如果我输入键盘中​​断,我总是会得到相同的回溯:

>
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

我是 Pod 的新手,任何帮助将不胜感激!

解决方法

  1. 你的pod安装成功了吗?
  2. 我 pod GooglePlaces 并成功,并运行成功 enter image description here
,

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

-framework "GoogleMapsBase" -framework "GooglePlaces"

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