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?
APNs issues a new token when the user restores a device from a backup, when the user installs your app on a new device, and when the user reinstalls the operating system. If you ask the system to provide the token each time, you're guaranteed to get an up-to-date token.
The registration token may change when: The app is restored on a new device. The user uninstalls/reinstall the app. The user clears app data.
Device Token: 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With