4

Since updating to Firebase Crash Reporting 3.8.0 via Cocoapods, I see the following error during builds for Debug mode. I am able to build in Release mode without error.

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_GTMLogNoFilter", referenced from:
      objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
  "_OBJC_CLASS_$_GTMLogBasicFormatter", referenced from:
      objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
      objc-class-ref in FirebaseCrash(uploader_089041b840f448492d858d7daf481e47.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
4

1 回答 1

5

当 XCode 设置Build Active Architecture Only在调试模式下设置为NO时,会发生这种情况。

一些 Firebase SDK 依赖于从源代码构建的 pod。默认情况下,CocoaPods 在 Debug 中运行时将所有从源构建的 Pod 的Build Active Architecture Only设置为YES。这种不匹配会导致您提到的缺少符号。

有两个选项可以解决此问题:

  1. 在主项目的调试中将Build Active Architecture Only切换为YES
  2. 在调试时将您的 pod 的Build Active Architecture Only设置为NO(取自这篇文章):

    post_install do |installer_representation|
      installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
      end
    end
    
于 2016-10-31T17:24:49.760 回答