How to take id from Firebasecloud Messaging (FCM). Then send it to WebServer. Grateful for any help.

    1 answer 1

    Import libraries into AppDelegate .

     import Firebase import FirebaseMessaging 

    If you connected everything correctly, you need to register the method in AppDelegate

      func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { if let refreshedToken = FIRInstanceID.instanceID().token() { print("InstanceID token: \(refreshedToken)") } } 

    In print , you will have the user's token displayed and can send it to the server. For all users, it will be unique. Good luck.