4

There's a push notification popup that appears on fresh install of app. There are two choices, OK and Don't Allow (if i remember it correctly.)

I want to know what's the call back method if I click "Don't Allow". The thing is, I implemented didFailToRegisterForRemoteNotifications because I thought that if I click "Don't Allow" it would go straight to that method in AppDelegate. However, the method wasn't called.

My problem is I need to know the event when user clicks on "Don't Allow". Is there a way to do this? I'd appreciate any help. Thanks.

cessmestreet
  • 2,298
  • 3
  • 22
  • 42
  • 1
    didFailToRegisterForRemoteNotifications is when communication with apple registration service fail, there is no way to know a user just clicked on don't allow, but you can check UIApplication, there is a method to know the state of PushNotification registration – Jerome Diaz Oct 31 '13 at 10:57
  • Did you find a work around? I posted anther question http://stackoverflow.com/questions/22934729/how-do-i-know-if-user-didnt-allow-push-notifications – Avba Apr 08 '14 at 10:49

2 Answers2

-3

There is no delegate callback however from here:Callback Method if user declines Push Notification Prompt?

You can have a BOOL variable to check it in your AppDelegate,

AppDelegate.m

// declare a BOOL 
BOOL allow = NO;

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
  allow = YES;
  [self doWhatever];
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
  allow = YES;
  [self doWhatever];
}
Community
  • 1
  • 1
Woodstock
  • 22,184
  • 15
  • 80
  • 118
-3
didFailToRegisterForRemoteNotifications 

is when communication with apple registration service fail, there is no way to know a user just clicked on don't allow, but you can check UIApplication, there is a method to know the state of PushNotification registration

NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; 
if (rntypes == UIRemoteNotificationTypeNote) {
    // application is not registered for any type of push notification
}
Jerome Diaz
  • 1,746
  • 8
  • 15