What is the difference between deviceToken of type Data and Fir InstanceID token of type optional String in Swift - IOS?

1.6k views Asked by At

I am new to Firebase Cloud Messaging and push notifications.

When we get registered for push notifications, this method is called

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
    {
        // deviceToken is received
    }

and then later, to send push notification we use this line of code to get the token:

    let myToken = FIRInstanceID.instanceID().token()!

Now I want to ask what is the difference between these tokens?

1

There are 1 answers

0
seggy On

Instance ID:

The Instance ID API lets you integrate Instance ID with your Android or iOS app. Instance ID provides a unique identifier for each instance of your app and a mechanism to authenticate and authorize actions, like sending messages via Google Cloud Messaging. click more

Device ID:

A device token is an identifier for the Apple Push Notification System for iOS devices. Apple assigns a Device Token on a per-app basis (iOS 7 and later) which is used as a unique identifier for sending push notifications. Each device has two device tokens per app: one for development, and one for production (ad hoc or app store builds). The tokens are 64 hexadecimal characters. click more