What should an iOS application do when a user disables push?

I know that it is possible to check whether the user has disabled push settings, as described in Goal c - Detect when the user changes application notification settings .

According to the article above, a push notification is sent even if the user has disabled push notifications for the application. As far as I understand, I should always register for push notifications in applicationDidFinishLaunching:

In most cases, it looks like this, that is, user settings are ignored.

 - (void)applicationDidFinishLaunching:(UIApplication *)app { // other setup tasks here.... [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; } 

If an application should consider these parameters, what does the correct implementation look like?

The reason I ask this question is because we have many clients complaining that they receive push notifications, although they have push notifications disabled. This is similar to iOS 6.

Do I, as a developer, have to take care of the case when the user has disabled push notifications? I read the documentation again and again. In particular, the documentation for application:didReceiveRemoteNotification: It does not indicate whether it is called when the user has disabled push notifications.

+4
source share
1 answer

make sure you implement these methods to find out if the device is registered or not

 - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)_deviceToken { if ([application enabledRemoteNotificationTypes] < 4) { NSLog(@"Notifications are disabled for this application"); return; } // The device is registered for notifications } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ NSLog(@"FAILED TO REGISTER FOR PUSH NOTIFICATIONS"); NSLog(@"%@", error.userInfo); } 

Register normally for push notifications every time the application starts. but you need to make sure that you implement the above methods to find out if disabled or disabled notifications are enabled for the application.

+3
source

All Articles