What should I do that for changing or requesting the token in firebase? the unique token generated by firebase on the basis of device information.
for now InstanceID.instanceID().token() is deprecated.
You should use this:
let instance = InstanceID.instanceID()
instance.deleteID { (error) in
print(error.debugDescription)
}
instance.instanceID { (result, error) in
if let error = error {
print("Error fetching remote instange ID: \(error)")
} else {
print("Remote instance ID token: \(String(describing: result?.token))")
}
}
Messaging.messaging().shouldEstablishDirectChannel = true
Then in AppDelegate:
extension AppDelegate: MessagingDelegate {
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
//Here is your new FCM token
print("Registered with FCM with token:", fcmToken)
}