6

When I install app for the first time and it asks for the permission for getting notification, if I press yes then the Device token is generated, but whenever I relaunch the app, I get the error:

Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)

Can anyone tell whether the device token is generated every time the app is launched?

AL.
  • 36,815
  • 10
  • 142
  • 281
anvesh yadav
  • 166
  • 2
  • 13
  • check:[http://stackoverflow.com/questions/6652242/does-the-apns-device-token-ever-change-once-created](http://stackoverflow.com/questions/6652242/does-the-apns-device-token-ever-change-once-created) and [http://stackoverflow.com/a/40169657/5575752](http://stackoverflow.com/a/40169657/5575752) – Ronak Chaniyara Feb 03 '17 at 10:40

2 Answers2

5

Nope. A (new) token is not generated every time the app is launched. It is generated on initial launch (i.e. first launch after app install). From the docs:

By default, the FCM SDK generates a registration token for the client app instance on initial startup of your app.

But it may change because of the following scenarios (also from the docs):

The registration token may change when:

  • The app deletes Instance ID
  • The app is restored on a new device
  • The user uninstalls/reinstall the app
  • The user clears app data.
Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
0

Today the doc says https://firebase.google.com/docs/cloud-messaging/ios/client#access_the_registration_token

The app is restored on a new device

The user uninstalls/reinstall the app

The user clears app data.

Seems like FCM Token is not generated when we delete the instance ID.

Community
  • 1
  • 1
Ashwin Mothilal
  • 2,462
  • 1
  • 16
  • 21