2017-02-07 31 views
-1
if #available(iOS 10.0, *) { 
    let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] 
    UNUserNotificationCenter.current().requestAuthorization(
     options: authOptions, 
     completionHandler: {_, _ in } 
    ) 

    // For iOS 10 display notification (sent via APNS) 
    UNUserNotificationCenter.current().delegate = self 
    // For iOS 10 data message (sent via FCM) 
    FIRMessaging.messaging().remoteMessageDelegate = self //ERROR THIS LINE 

} 
else { 
    let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil) 
    application.registerUserNotificationSettings(settings) 
} 

將代理設置爲self時出現錯誤。 「FIRMessing沒有會員remoteMessageDelegate」swift 2.0中的FCM推送通知錯誤

回答

0

看起來谷歌文檔已過時。

請在你的終端運行以下命令:

pod repo update 

然後轉到您的項目文件夾,然後運行

pod update 

(請註明這是解決辦法,如果這有助於你)

0

試試這個:

class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, FIRMessagingDelegate{ 
} 

//MARK: FIRMessaging Delegate 
func applicationReceivedRemoteMessage(remoteMessage: FIRMessagingRemoteMessage){ 
}