I am using this code to get the Notification Center Device token.
It was working in Swift 3 but not working in Swift 4. What changed?
if #available(iOS 1
You can use this both function for getting Device Token & FCM Token:
For device token use this:
func application(_ application:UIApplication,didRegisterForRemoteNotificationsWithDeviceToken
devicetoken: Data)
{
let deviceTokenString = deviceToken.hexString
print(deviceTokenString)
}
For FCM token use this:
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
print("Firebase registration token: \(fcmToken)")
userDefault.set(fcmToken, forKey: "fcmToken")
}
For UUID use this:
let deviceIds = UIDevice.current.identifierForVendor!.uuidString