Firebase架构x86_64的未定义符号

gde*_*dev 19 ios firebase

我正在使用firebase作为我在iOS中工作的项目的一部分,当我尝试针对iPhone 6或7模拟器进行编译以进行测试时,我偶然发现了以下链接错误.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GTMSessionUploadFetcher", referenced from:
      objc-class-ref in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in FirebaseMessaging(GIPReachability_ae5504e4a6a28a1d8997c6f38e8bff8b.o)
  "_kGTMSessionUploadFetcherStandardChunkSize", referenced from:
      -[FIRStorageUploadTask enqueue] in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
  "_GTMFetcherStandardUserAgentString", referenced from:
      -[FIRAuthBackendRPCIssuerImplementation init] in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
      objc-class-ref in FirebaseStorage(FIRStorageDownloadTask_c390366e83519f6636ca985ecb70e5d0.o)
      objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
      objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我正在使用Xcode 8.2.1,swift 3.0,我的项目中也有以下Pod文件

pod 'Braintree'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'GeoFire', :git=>'https://github.com/firebase/geofire-objc.git'
pod 'ObjectMapper', '~> 2.2'
Run Code Online (Sandbox Code Playgroud)

我做了一个pod更新,以防有些东西过时,但没有运气.当我使用iPhone 4或5模拟器时,代码编译并运行正常.

编辑:

我已将Build Active架构设置为No,在有效架构中我列出了arm64,armv7,armv7s,现在Objectmapper即使import ObjectMapper在文件中声明也失败了

 Use of undeclared type 'Mappable'
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!先感谢您.

乔治.

Qua*_*yen 20

对我来说,我刚刚将Firebase框架安装到Xcode,而不是因为其他无法解决的问题而使用CocoaPods.在构建之后,存在类似的错误,例如"未找到架构x86_64的符号".(也许是因为我在VMWare上使用Xcode)

然后我必须手动转到General - Linked Frameworks and Libraries并添加:

libsqlite3.tbd,libz.tbd,libc ++.tbd

为了项目的工作.

  • 对我来说,它是libsqlite3.tdb,libc ++.tbd,StoreKit.framework (5认同)
  • 根据 Firebase 自述文件,添加这些链接库不是必需的。这些库由一个或多个 Firebase 框架使用。对我有用的是创建一个桥接标头,向其中添加“#import Firebase.h”,然后在“构建设置”>“Objective-C 桥接标头”中引用它。 (2认同)

coy*_*yer 15

刚刚发现了类似的问题,并通过清除Pod-Cache解决了它。

清除CocoaPods缓存

吊舱解集成&&吊舱缓存清洁-全部

重新安装吊舱

吊舱安装

  • 删除 `./Pods/` 文件夹并运行 `pod install` 也可以:) (3认同)

Lee*_*mur 11

使用 CocoaPods 为 Firebase 安装 pod 后也遇到了这个问题,如 Firebase 站点中所述:

https://firebase.google.com/docs/ios/setup?hl=es-419#prerequisites

吊舱“Firebase/Analytics”吊舱“Firebase/Auth”

在安装 Pod 的过程中,我收到了一条警告:

[!] The target `myTarget [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `myTarget [Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)

当我编译时,我收到了几个文件的错误:

Undefined symbols for architecture x86_64:
Run Code Online (Sandbox Code Playgroud)

我在本答案中的答案之前尝试了以下答案的解决方案,它很有魅力:

目标 ... 覆盖 `Pods/Pods.xcconfig 中定义的 `OTHER_LDFLAGS` 构建设置

基本上解决方案是(如@Ankish Jain 所解释的):

转到您的目标构建设置 -> 其他链接器标志 -> 双击 -> + 按钮。将 $(inherited) 添加到新行。

之后我编译成功,新标志自动添加到构建设置中。


小智 8

我尝试了“清除 Cocoapods 缓存”和“删除派生数据”解决方案,但没有奏效。对我有用的是我在 Carthage 设置中找到的一个步骤(我仍在使用 Cocoapods)

$(OTHER_LDFLAGS) -ObjC标志添加到“构建设置”中的“其他链接器标志”。

您可以在此处查看该步骤:https : //github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md

我的信息

安装:Cocoapods | SDK:FirebaseAnalytics (6.1.2) | IDE:Xcode 11.0 | macOS:莫哈韦沙漠 10.14.5 测试版 | 语言:Swift 4.2 | 平台目标:iOS 11.0+


Mar*_*kov 7

也有这个问题......
添加 $(inherited)到构建设置中的其他链接器标志,现在一切正常


gde*_*dev 5

衍生数据似乎是一个小故障。我退出了Xcode,删除了所有的“派生数据”/Users/USER_NAME/Library/Developer/Xcode/PROJECT_NAME

重新启动Xcode,进行编译,所有操作均按预期进行,无需更改任何Active Architecture Only内容。

  • 在终端中执行:`rm -rf ~/Library/Developer/Xcode/DerivedData` (4认同)

Aug*_*gie 5

我尝试了这个问题中的解决方案,但没有任何效果。还在 SO 和 GitHub 问题中找到了其他线程。没有任何帮助。我正在使用 Xcode 9.2、Swift 4、最新版本的可可豆荚。这对我有用...

首先,我的 podfile 只包含一个 firebase pod,因为此时我只使用 Analytics,但是如果您使用更多,解决方法应该是相同的。
吊舱“Firebase/核心”

其次,像文档说明一样,确保将 -ObjC 添加到您的其他链接器标志中。我在项目和目标级别的构建设置中都这样做了。他们是不同的。

第三个也是最重要的,在项目级别的构建设置,其他链接器标志,添加以下内容

-框架

“火力地基核心”

-框架

“Firebase 分析”

-框架

“FirebaseInstanceID”

-框架

“FirebaseNanoPB”

-框架

“FirebaseCoreDiagnostics”

-框架

“纳米”


小智 5

在没有 CocoaPods ( https://firebase.google.com/docs/ios/setup#frameworks ) 的情况下进行集成的步骤之后,我遇到了同样的问题,其他答案都没有帮助我。

对我有用的是从目标的构建设置上的其他链接器标志中删除 -ObjC。

我仍然不确定为什么它会起作用,即使它明确地写在添加这个标志的步骤上,只是想分享对我有用的东西,以尝试帮助其他人。