我正在尝试将firebase消息传递添加到我的iOS应用中。我已经遵循了firebase文档中的步骤:
- 上传了APNS证书
- 导入的火箱并添加了
[FIRApp configure]
- 带有
@import FirebaseMessaging
的导入火箱消息并添加了FIRMessagingDelegate
但是,在这一点上,我有一个错误:
@interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate>
// Cannot find protocol declaration for FIRMessagingDelegate
我已经更新了我的豆荚(通过在堆栈溢出上发现的类似问题提出),但仍然遇到相同的错误。要确认,运行pod update
给出以下输出:
Using FirebaseMessaging (1.2.2)
有什么建议?
问题似乎是在新的FirebaseMessaging
Framework中声明了FIRMessagingDelegate
协议。
简单地添加:
@import FirebaseMessaging;
请参阅更多信息:https://firebase.google.com/docs/reference/ios/firebasemessaging/api/reference/protocols/firmessagingdelegate
和示例应用程序AppDelegate.m
这里:https://github.com/firebase/quickstart-ios/blob/master/messaging/messaging/messagingexample/appdelegate.m#l62-l85
我在POD文件中发现了这一点:
pod 'Firebase/Messaging'
to
pod 'Firebase/Messaging', '~> 4.0.0'
现在找到了所有依赖。
,因为我的搜索把我带到这里,要在这里分享:
如果您正在迅速且遇到此错误,则" FIR"前缀已在所有名称中删除,因此您只需使用" MessagingDelegate"而不是'FirmagingDelegate'
来源:https://firebase.google.com/docs/reference/swift/naming-migration-guide