Search code examples
iosswiftapple-push-notificationsdevicetoken

What is APNS Device Token composed of?


What is the device token received in didRegisterForRemoteNotificationsWithDeviceToken composed of?

This device token is used to uniquely identify an application when pushing notifications from server. But my query is as to what this device token is made up of?


Solution

  • Quoting from apple docs

    What is Device Token

    A device token is an opaque NSData instance that contains a unique identifier assigned by Apple to a specific app on a specific device. Only APNs can decode and read the contents of a device token. Each app instance receives its unique device token when it registers with APNs

    How its Generated

    When a new device token is needed, APNs generates one using information contained in the device’s certificate. It encrypts the token using a token key and returns it to the device, as shown in the middle, right-pointing arrow.

    For more detail read : https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html

    I could write whole theory but then it would be repetition of doc :)