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
The recommended way by Firebase:
let token = Messaging.messaging().fcmToken
Reference : Setting Up a Firebase Cloud Messaging Client App on iOS
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 ---------------➤")
}
}
FCM Device Token swift3
let fcmDeviceToken = FIRInstanceID.instanceID().token()
print("FCM token: \(fcmDeviceToken ?? "")")