This code will redirect you to setting of notifications.
if ([[UIApplication sharedApplication] currentUserNotificationSettings].types != UIUserNotificationTypeNone)
{
NSLog(@" Push Notification ON");
}
else
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Push Notification Service Disable ,please enable it." message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"Okay!" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
{
@try
{
NSLog(@"tapped ok");
BOOL canOpenSettings = (UIApplicationOpenSettingsURLString != NULL);
if (canOpenSettings)
{
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
}
@catch (NSException *exception)
{
}
}]];
[self.view presentViewController:alertController animated:YES completion:^{}];
}
It will redirect to following screen
