2017-09-03 81 views
1

使用Swift 2.3 - Firebase 4Swift - Firebase - applicationReceivedRemoteMessage衝突

| * |如果我試圖實現此方法的說:

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

Objective-C的方法「applicationReceivedRemoteMessage:」通過法協議提供「applicationReceivedRemoteMessage」可選要求法衝突「的應用程序(收到:)「MessagingDelegate」

請讓我知道這是新的正確的方法

回答

1
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