2
   UNUserNotificationCenter *notificaitnCenter = [UNUserNotificationCenter currentNotificationCenter];
    [notificaitnCenter requestAuthorizationWithOptions:UNAuthorizationOptionBadge | UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionProvidesAppNotificationSettings completionHandler:^(BOOL granted, NSError * _Nullable error) {
        if (granted) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [[UIApplication sharedApplication] registerForRemoteNotifications];

            });

        }
    }];

After implementing this snippet of code also i am unble to see the Notification settings option.

Mayank
  • 315
  • 2
  • 13
Sandeep
  • 21
  • 4

1 Answers1

1
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")){
    UNUserNotificationCenter *notifiCenter = [UNUserNotificationCenter currentNotificationCenter];
    notifiCenter.delegate = self;
    [notifiCenter requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
        if( !error ){

            dispatch_async(dispatch_get_main_queue(), ^{
                [[UIApplication sharedApplication] registerForRemoteNotifications];
            });

        }
    }];

}
else
{
    UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
}

Might be the ios version not supporting Try this code

AJ Sanjay
  • 1,276
  • 1
  • 12
  • 29