0

We are using device token as a unique ID for track app installs. But I can see the device token will not be available in didRegisterForRemoteNotificationsWithDeviceToken if user selected Don't Allow for push notification pop up in first installation. Please advice.

2

We are using device token as a unique ID for track app installs.

This is explicitly disallowed by the APNS guidelines and it's a great way to get your app yanked out of the app store.

But even if this were allowed, it's still an awful way to track app installs because (1) the user can reset her APNS tokens at any time, and (2) the same app run by the same user on multiple devices will have multiple APNS tokens, and (3) please don't abuse your users' trust in this manner. This is not what APNS is for and it violates your users' expectations and privacy.

But I can see the device token will not be available in didRegisterForRemoteNotificationsWithDeviceToken if user selected Don't Allow for push notification pop up in first installation.

That's right. This delegate method will not be called if the user does not grant you that permission.

Edit: There is a better way to do this.

| improve this answer | |
  • Jonathan, Thank you very much for your response. But as per my understanding the UUID will change for the every reinstallation of the App. Will it be work if I used it like mentioned in this. stackoverflow.com/questions/21878560/… – GihanLiyanage Feb 5 '16 at 4:37
  • UUIDs don't change and the NSUUID class is immutable. You can generate as many new ones as you want. If you want to persist an identifier, you have to... well, persist an identifier, either locally or on your server. It is true that the app's keychain storage is not cleared when an app is deleted, and it's true that you could persist your UUID in the keychain, and it's true that this is still a slimy thing for you to do. – Jonathan Hersh Feb 5 '16 at 4:43
  • Hi Jonathan, I am going to use above NSUUID and save it to keychain approach for unique ID. What will happen if the user Sync key chain to a new device. I do not need to have same unique ID for two devices, even if the user is same. Can we disable syncing our custom key from keychain, when user synching key chain? – GihanLiyanage Feb 19 '16 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.