Swift AppDeligate 不符合协议 'MessagingDelegate'

Swift AppDeligate does not conform to protocol 'MessagingDelegate'

使用 Swift2.3 和 Xcode8
我将 Firebase 升级到版本 4

我关注了新版本中提到的所有更改 https://firebase.google.com/docs/reference/ios/naming-migration-guide#changes_in_the_new_version

我仍然收到一个错误

Type 'AppDelegate' does not conform to protocol 'MessagingDelegate'

我不知道这个方法改成什么或者我需要添加哪个新方法。 请帮助我

class Appdelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate
{
    func application(remoteMessage: MessagingRemoteMessage)
    {
        let remoteMsgVar = remoteMessage.appData
        print("remoteMessage : ", remoteMsgVar)
    }
}

为了符合 MessagingDelegate 协议,您必须包含以下功能:

func messaging(messaging: Messaging, didRefreshRegistrationToken fcmToken: String)
{

}

/// This method is called on iOS 10 devices to handle data messages received via FCM through its
/// direct channel (not via APNS). For iOS 9 and below, the FCM data message is delivered via the
/// UIApplicationDelegate's -application:didReceiveRemoteNotification: method.
@available(iOS 10.0, *)
func messaging(messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage)
{
    let FcmRcdNfnNryVal = remoteMessage.appData
    print("iOS 10.0 FcmRcdRmtNfnMsg : ", FcmRcdNfnNryVal)

}

为了将来参考,Xcode8 将在错误下向您显示协议中需要哪些功能:

对于使用 Xcode 9 的任何人,您可以直接从错误消息中添加协议存根。