Firebase didRefreshRegistrationToken is not working in iOS Swift
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!
精彩评论