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.

2
  • 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 Oct 31, 2013 at 10:57
  • Did you find a work around? I posted anther question stackoverflow.com/questions/22934729/…
    – Avba
    Apr 8, 2014 at 10:49

2 Answers 2

-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];
}
3
  • I see. so there's no way to solve my problem then. thank you so much for all the replies. Oct 31, 2013 at 11:42
  • 1
    pasting code from another question isn't an answer Oct 31, 2013 at 12:18
  • @JeromeDiaz no need to get upset Jerome, I referenced the original/
    – Woodstock
    Oct 31, 2013 at 12:42
-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
}
2
  • didFailToRegisterForRemoteNotifications is not called when a user clicks no.
    – Woodstock
    Oct 31, 2013 at 11:09
  • 1
    read my text, I already said it it wasn't called, I even told it in the comment below the question before you even put your own answer Oct 31, 2013 at 12:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.