We are working on an app that is suposed to receive push notifications. On our test device when we were prompted for an ok to send notifications we clicked ok but failed to store the token that we received. (The request to the server on our end was not handled properly and the token was not stored anywhere else by us).
We have tried the following to have the function didRegisterForRemoteNotificationsWithDeviceToken trigger again (to no avail):
However, we cant get it to 'prompt' us again, and the APN development server seems to have already registered so I am assuming that is why the didRegisterForRemoteNotificationsWithDeviceToken doesnt trigger again.
In the end we cannot get a new token, and I don't know how to retrieve the already registered token. Does anyone know how to retrieve the already registered token?
if you call registerForRemoteNotificationTypes: method of UIApplication every time your application launch, the application:didRegisterForRemoteNotificationsWithDeviceToken: delegate method will be called every time also. When the first time registration, iOS will ask user if they want receive notifications, and iOS connect the Apple Notification Service to register and get device token. After that, registerForRemoteNotificationTypes: method call will neither ask user nor connect APN, iOS will immediately call delegate method with the already registered token.
if you want to the Application launching to ask user again, call the unregisterForRemoteNotifications , then call registerForRemoteNotificationTypes: method again.
some detail information related: iOS Application Client Side Device Token Management With Apple Push Notification
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