2

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!

Community
  • 1
  • 1
djcouchycouch
  • 12,724
  • 13
  • 69
  • 108

1 Answers1

0
  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"];
    }
    
mergesort
  • 672
  • 4
  • 10
  • Pointer 1 of this answer is wrong. Excluding the app from Notification Center does disable local notification. We've tested on actual device. – Luong Huy Duc May 14 '14 at 03:43