使用 Swift 2.3 - Firebase 4
|*|如果我尝试实现此方法,它会说:
func applicationReceivedRemoteMessage(remoteMessage: MessagingRemoteMessage)
{
print("%@", remoteMessage.appData)
}
Objective-C method 'applicationReceivedRemoteMessage:' provided by method 'applicationReceivedRemoteMessage' conflicts with optional requirement method 'application(received:)' in protocol 'MessagingDelegate'
请告诉我哪个是新的正确方法
最佳答案
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/