2
votes

I can't find sure answers on some questions I had about push/local notifications.

  1. Does disabling push notifications also disable local notifications?

  2. Can I detect if the user has disabled push notifications for my application? If so, how do I do that? EDIT: Just as I submitted the question, I found: Determine on iPhone if user has enabled push notifications That's the recommended way?

Thanks!

1

1 Answers

0
votes
  1. Disabling push notifications does not disable local notifications, they are independent of each other.
  2. You can check that way, that will indeed work. Another alternative is to set a persistent flag in your AppDelegate class.

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"registeredForPush"];
    }
    
    - (void) application: (UIApplication *) application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
    {
        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"registeredForPush"];
    }