ios - 为什么我得到未定义的符号_OBJC_CLASS_$_FIRInstanceID?
问题描述
这是一个使用 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,并pod install
再次对我的 shell 说,以反映我改变主意。这是发生的事情:
$ 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 代码并尝试再次编译它会发出关于 undefined symbol 的相同消息_OBJC_CLASS_$_FIRInstanceID
。将其注释掉并重新编译运行应用程序就好了,尽管我仍然在输出窗口中看到“Firebase Analytics 不可用”消息。)
解决方案
推荐阅读
- python - 在 Python 中从 PrivateKey/CertificateRequest/Certificate 中提取公钥模数,格式与 OpenSSL 相同
- sql-workbench-j - 如何更改 SQL Workbench/J 中的活动数据库连接?
- django - 如何在 django 中编辑或修改我的布尔字段
- javascript - JS 插入字符串 ${ }
- react-native - Moment JS 看似返回随机日期
- vba - VBA:通过 HTTPS 下载图片
- ios - 滚动和缩放到 UIImageView 的特定 CGRect
- java - 使用比较器排序
- javascript - update-element.js 中的 Lit-Element 数据加载错误
- javascript - onHeadingChange(event) 获取几何相反位置的单个值