为什么我得到未定义的符号_OBJC_CLASS _ $ _ FIRInstanceID?

时间:2018-10-24 19:27:50

标签: ios swift firebase

这是一个使用Firebase的iOS应用。

如果我注释掉获取Firebase的instanceID令牌的代码,则可以编译和链接。

我用CocoaPods安装了Firebase。完全没有错误,没有警告。 (在pod install之前,我做了pod update。所以我得到了最新的Firebase。)

引用来自AppDelegate.o。在AppDelegate.swift中,我有

import UserNotifications import Firebase import FirebaseInstanceID import FirebaseMessaging import GoogleUtilities

我知道您会要求了解有关环境的更多信息。我不确定我应该给你看的一切。当您索取更多信息时,我将编辑问题。

更新1 :这也是我在输出窗口中注意到的内容。

<Warning>: 5.8.0 - [Firebase/Core][I-COR000022] Firebase Analytics is not available. To add it, include Firebase/Core in the Podfile or add FirebaseAnalytics.framework to the Link Build Phase

但是我的Podfile看起来还不错。这是我的Podfile。

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'XKCD' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for XKCD

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

  target 'XKCDTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'XKCDUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

更新2 :这似乎是一个非常相关的事件。我将Firebase / Database添加到我的Podfile中只是为了查看是否可以使用该数据库。我什至无法编译带有更多链接错误的项目,因此我完全放弃了任务,从Podfile中删除了Firebase / Database,并再次对我的shell说了pod install以反映我的想法。这是发生了什么:

$ pod install
Analyzing dependencies
Removing FirebaseAuth
Removing FirebaseAuthInterop
Removing FirebaseDatabase
Removing GTMSessionFetcher
Removing leveldb-library
Downloading dependencies
Installing Firebase 5.11.0 (was 5.8.0)
Installing FirebaseAnalytics 5.3.0 (was 5.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseAnalyticsInterop (1.1.0)
Installing FirebaseCore 5.1.6 (was 5.1.3 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseInstanceID 3.3.0 (was 3.2.1 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing FirebaseMessaging 3.2.1 (was 3.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing GoogleAppMeasurement 5.3.0 (was 5.1.2 and source changed to `https://github.com/CocoaPods/Specs.git` from `https://github.com/cocoapods/specs.git`)
Installing GoogleUtilities 5.3.4 (was 5.2.3)
Using Protobuf (3.6.1)
Using nanopb (0.3.8)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 10 total pods installed.

[!] Automatically assigning platform `ios` with version `8.0` on target `XKCD` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

我暂时没有结论。 (取消对InstanceID代码的注释并尝试再次对其进行编译会吹出与未定义符号_OBJC_CLASS_$_FIRInstanceID相同的消息。将其注释掉并重新编译可以很好地运行该应用程序,尽管我仍然看到“ Firebase Analytics不可用”消息输出窗口。)

0 个答案:

没有答案