I have used the following code to register my app to receive push notification, and I got the alert that asks me to register for push notification and I accidentally press cancel. Now I want to have the alert again so I can fire the delegate method in order to get the device token. But I don't get this alert any more and every time I open the settings I found that the notification is turned off for the app. I tried to delete the app from device, change app version, delete testing profile ,clean the target even I reset all the iPhone settings, but still was not able to solve this.I would very much appreciate any help, thanks
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
During development only, of course.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
Delete your app from the device. Turn the device off completely and turn it back on. Go to Settings > General > Date & Time and set the date ahead a day or more. Turn the device off completely again and turn it back on.
Don't forget to turn it off completely and back on.