0

One of our company's iPhone applications uses a push notification the first time the user install the application. The notification pops up a system alertView to ask the user if its allowed receiving push notification.

My Question is how to know the user pressed "allowed" or "not allowed".

Josiah Hester
  • 6,065
  • 1
  • 24
  • 37
BPS1945
  • 153
  • 1
  • 1
  • 9

1 Answers1

-1

For remote notifications -- If the registration succeeded, your application delegate will get a callback to this method:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

If it failed, the callback will instead come to this method:

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

Note that there are reasons the registration could fail other than the user pressing the "not allowed" button. See here for more information.

William Jockusch
  • 26,513
  • 49
  • 182
  • 323
  • `didFailToRegisterForRemoteNotificationsWithError` is not called, when the user is pressing the deny button. While it is possible to find out, what rights are given by calling `[[UIApplication sharedApplication] enabledRemoteNotificationTypes]`, I have not found any way yet, to find this out through a callback. – Tim Bodeit Aug 20 '13 at 21:05