applicationReceivedRemoteMessage

applicationReceivedRemoteMessage

使用Swift 2.3-Firebase 4

| * |如果我尝试实现此方法,它会说:

func applicationReceivedRemoteMessage(remoteMessage: MessagingRemoteMessage)
{
    print("%@", remoteMessage.appData)
}

方法“applicationReceivedRemoteMessage”提供的Objective-C方法“applicationReceivedRemoteMessage:”与协议“MessagingDelegate”中的可选需求方法“application(received :)”冲突

请让我知道哪种是新的正确方法

最佳答案

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
     // Let FCM know about the message for analytics etc.
     FIRMessaging.messaging().appDidReceiveMessage(userInfo)
     // handle your message
   }

参考:https://firebase.google.com/docs/cloud-messaging/ios/receive

关于ios - Swift-Firebase-applicationReceivedRemoteMessage冲突,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46021021/

10-08 21:38