开发者

Firebase didRefreshRegistrationToken is not working in iOS Swift

开发者 https://www.devze.com 2022-12-07 18:32 出处:网络
I am implementing firebase push notification and everything working fine. I receive FCM token and Push notification as well. But i need to manage something whenever the FCM token is refreshed/renewed.

I am implementing firebase push notification and everything working fine. I receive FCM token and Push notification as well. But i need to manage something whenever the FCM token is refreshed/renewed. 开发者_C百科For this i tried setting up Notifications in didFinishLaunch of AppDelegate:

NotificationCenter.default.addObserver(self, selector: #selector(self.tokenRefreshNotification), name: NSNotification.Name.MessagingRegistrationTokenRefreshed, object: nil)

and 'tokenRefreshNotification' function is called every time i open my application so, it's not working. Another delegate :

func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) {
      print("refresh")

}

It's never called. Messaging Delegate is set and everything else is up and running. Please help me figure out how can i get notified whenever FCM token is refreshed. Thanks in advance!

0

精彩评论

暂无评论...
验证码 换一张
取 消