Somewhat similar to When is didRegisterForRemoteNotificationsWithDeviceToken called?.
When the user first installed the app and it prompts whether to accept notification, will didRegisterForRemoteNotificationsWithDeviceToken be called if the user accepts it?
I'm currently calling registerForRemoteNotificationTypes after the user successfully signs in or creates an account.
In subsequently launches, the didRegisterForRemoteNotificationsWithDeviceToken delegate is called even without calling registerForRemoteNotificationTypes in AppDelegate.
If I follow the docs and example code:
By requesting the device token and passing it to the provider every time your application launches, you help to ensure that the provider has the current token for the device.
- (void)applicationDidFinishLaunching:(UIApplication *)app {
// other setup tasks here....
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:...
}
But by requesting the token when the app launches, the delegate will be called twice.
A couple of questions and clarity needed:
For the initial prompt to happen, a call for
registerForRemoteNotificationTypesmust be made for the prompt to appear? But, the delegate will be called twice if I call this manually in AppDelegate. Is it suppose be that way?If the user accepts the initial prompt, will
didRegisterForRemoteNotificationsWithDeviceTokenbe called automatically? Or must we invokeregisterForRemoteNotificationTypesin AppDelegate? But then the delegate will be called twice for future launches?If the user denies and later accept it via Setting, what happens?
UPDATE
0. For the initial prompt to happen, a call for registerForRemoteNotificationTypes must be made for the prompt to appear? But, the delegate will be called twice if I call this manually in AppDelegate. Is it suppose be that way? This isn't true. Found out that there were actually 2 registerForRemoteNotiicationTypes being made in AppDelegate.