Firebase v3中的一切都运行良好 我最近升级到了Firebase v4 我实现了所有协议功能。
Stil收到msg未处理,我收到警告
[Firebase / Messaging] [I-FCM002019] FIRMessaging收到的数据消息,但是FIRMessagingDelegate的消息:didReceiveMessage:未实现
func application(appPsgVar: UIApplication,
didReceiveRemoteNotification userInfo: [NSObject : AnyObject])
{
let remoteMessage = userInfo
print("Forground : remoteMessage : \(remoteMessage)")
Messaging.messaging().appDidReceiveMessage(remoteMessage)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
{
let remoteMessage = userInfo
print("Background : remoteMessage : \(remoteMessage)")
Messaging.messaging().appDidReceiveMessage(remoteMessage)
completionHandler(UIBackgroundFetchResult.NewData)
}
// Fcm Message Received Handler Functions :
func application(received remoteMessage: MessagingRemoteMessage)
{
// What message comes here?
print("remoteMessage.appData : ", remoteMessage.appData)
}
// older way
func application(remoteMessage: MessagingRemoteMessage)
{
print("remoteMessage.appData : ", remoteMessage.appData)
}
// Fcm Message protocol Functions :
func messaging(messaging: Messaging, didRefreshRegistrationToken fcmToken: String)
{
print("New FCM Token received : \(fcmToken)")
}
@available(iOS 10.0, *)
func messaging(messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage)
{
// What message comes here ?
print("remoteMessage.appData : ", remoteMessage.appData)
}
| * |如果我尝试实现这种方法,它会说:
func applicationReceivedRemoteMessage(remoteMessage: MessagingRemoteMessage)
{
print("%@", remoteMessage.appData)
}
Objective-C方法' applicationReceivedRemoteMessage:'由方法' applicationReceivedRemoteMessage提供'与可选的要求方法和应用程序(收到:)和#39;的冲突在协议' MessagingDelegate'
请告诉我哪种方法是正确的