Correct way to retrieve token for FCM - iOS 10 Swift 3

前端 未结 15 2055
日久生厌
日久生厌 2021-01-31 02:42

i had implement Firebase with FirebaseAuth/FCM etc and did sent notification successfully through Firebase Console.

However i would need to push the notification from m

15条回答
  •  猫巷女王i
    2021-01-31 03:14

    To Get current FCM Token

    if let token = Messaging.messaging().fcmToken {
        // token is current fcmToken
    }
    

    To Renew current FCM Token

    If we delete current instanceId, new token will be received vi MessagingDelegate (messaging:didReceiveRegistrationToken) a moment later.

    InstanceID.instanceID().deleteID { (error) in
        if let er = error {
            print(er.localizedDescription)
        } else {
            print("instanceID().deleteID  success ---------------➤")
        }
    }
    

提交回复
热议问题