Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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:^{}];
- }
Add Comment
Please, Sign In to add comment