0

When device is registered for remote push notification the following method is called back.

(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

My question is

  1. Can one use this(deviceToken) to uniquely identify device. If yes then what is the life cycle(I mean is it really uniq) of this?
  2. Under what circumstances can the deviceToken provided can change?
  3. If this is uniq per device till the life of device(for a particular app vendor) then can one use this as an alternative over Unique Identification of iOS device ?

Edit I intended to write device in the question heading but wrote user.

Community
  • 1
  • 1
zeal
  • 465
  • 2
  • 11
  • 22

1 Answers1

2

To your first question - push device token is not linked to a user. If same user login to another device he shall get a different token and if another user login to the same device, he shall also share the token with user 1.

And to answer both second & third question, here is a sample text from Apple documentation:

The form of this phase of token trust ensures that only APNs generates the token which it will later honor, and it can assure itself that a token handed to it by a device is the same token that it previously provisioned for that particular device—and only for that device.

If the user restores backup data to a new device or reinstalls the operating system, the device token changes.

So, crux of the matter is device push token shall never be used as an alternative to unique identifier or UUID.

EDIT: Per OP edit, as per above Apple documentation, since push device token can change, it should not be considered as unique identifier for a device.

Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • Thanks a lot man. I should only use UUID for uniquely identifying device the deviceToken by APNS can not be trusted. – zeal Sep 25 '15 at 15:09
  • You got it right. No worries. Glad, it clarified. Could you please accept the answer to avoid duplicity and benefit for others. – Abhinav Sep 25 '15 at 15:11
  • please edit your answer accordingly which should reflect the question edit. – zeal Sep 25 '15 at 15:12