Search code examples
iospermissionsnotificationsuilocalnotificationlocalnotification

Not to ask for permission for notifications in iOS but add "notification permission settings" into device settings?


I don't want to show "ask permission for notifications" dialog and just add disabled settings for my application into device settings.

The problem is if the application doesn't request these permissions then the relevant settings doesn't appear in device settings at all.

My code to call permission dialog:

UIUserNotificationType types = UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];

Could you help to solve this issue? Currently I use local notifications only


Solution

  • As per Apple documentation, you must ask for user permission first time. So in order to have settings you will have to ask user atleast once.

    enter image description here