Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 769
Mustajab Haider Avatar asked Oct 29 '22 15:10

Mustajab Haider


1 Answers

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

like image 121
seggy Avatar answered Nov 15 '22 05:11

seggy