Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'MessagingRemoteMessage' is deprecated: FCM direct channel is deprecated, please use APNs for downstream message handling

How to handle this kind of warning

I have used

func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
    print("message data : \(remoteMessage.appData)")
}
like image 466
Bijoy A B Avatar asked May 29 '20 05:05

Bijoy A B


1 Answers

Do you really want to use remoteMessage: MessagingRemoteMessage ?

In my case, on the MessagingDelegate, the only thing I need is to get the fcmToken (Firebase Registration Token), I completely remove the remoteMessage: MessagingRemoteMessage

extension AppDelegate: MessagingDelegate{
    
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
        print("Firebase registration token: \(fcmToken)")
        
        let dataDict:[String: String] = ["token": fcmToken]
        
        firebaseData.fcmToken = fcmToken
        
        NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
    }
}
like image 117
Napster Scofield Avatar answered Nov 17 '22 11:11

Napster Scofield