How to show "Would like to send you Push Notifications" Alert View again?

ios, push-notification

Solution

At launch, your app should be requesting a token via:

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types

and will get a token from iOS in the delegate message:

– application:didRegisterForRemoteNotificationsWithDeviceToken:

iOS will prompt the user to allow notifications only when necessary. If remote notifications are already authorized for your app the alert will not appear and your app will get a valid token.

Net is you can't force the alert but you don't need to.

Problem

I was able to show an Alert View like the image above after registering for Remote Notifications. But when i delete my Project App and build it again, it will not show anymore. Will there be any chances to show the alert view again to the same device? What i like is to get my device token again because I failed to store the device token temporarily in the NSUserDefaults.

Original source

Related problems