使用未获得的标识符FIRMessaging

Gra*_*Fox 13 ios firebase swift firebase-notifications

在我的iOS Swift应用程序中集成Firebase Notification新API时,我遇到了一个奇怪的问题.从Firebase网络平台发送推送通知时遇到一些困难.我的证书没问题,因为我用快速的PHP脚本测试它,以便向我的手机发送测试通知.

在这篇文章中:https://stackoverflow.com/a/37467793/5082848,据说在AppDelegate中添加

func applicationDidBecomeActive(application: UIApplication) {
    FIRMessaging.messaging().connectWithCompletion { error in
        print(error)
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,FIRMessaging未知,而我的podfile正确包含Firebase/Messaging.以下是pod安装后终端返回的内容:

使用Firebase(3.3.0)

使用FirebaseAnalytics(3.2.1)

使用FirebaseInstanceID(1.0.7)

使用GoogleInterchangeUtilities(1.2.1)

使用GoogleSymbolUtilities(1.1.1)

使用GoogleUtilities(1.3.1)

你有什么线索吗?非常感谢

t4n*_*hpt 24

您应该导入FirebaseMessaging

import FirebaseMessaging
Run Code Online (Sandbox Code Playgroud)


小智 21

从3.3降级到3.2为我解决了这个问题.要获取信使库,您必须单独安装它的pod.

pod 'Firebase/Messaging' 
Run Code Online (Sandbox Code Playgroud)


小智 11

打开podfile

  1. 添加:pod'Firebase/Messaging'

  2. 安装/更新pod

  3. 添加:在AppDelegate中导入FirebaseMessaging

它对我有用.