The IOS app that I'm building uses push notifications. Apple requires you to ask the user wether they want this or not, the first time they run the app:
if([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
}
But, the user could change his/her mind during the use of the application and toggle notifications on or off in a settings controller by use of a UISwitch.
How can I catch the current notifications value and register/unregister the user from the notifications? This is what I have found on the internet but doesn't seem to work:
[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
[[UIApplication sharedApplication] isRegisteredForRemoteNotifications];