Guest User

Untitled

a guest
Dec 15th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. if ([[UIApplication sharedApplication] currentUserNotificationSettings].types != UIUserNotificationTypeNone)
  2. {
  3. NSLog(@" Push Notification ON");
  4. }
  5. else
  6. {
  7. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Push Notification Service Disable ,please enable it." message:nil preferredStyle:UIAlertControllerStyleAlert];
  8. [alertController addAction:[UIAlertAction actionWithTitle:@"Okay!" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
  9. {
  10. @try
  11. {
  12. NSLog(@"tapped ok");
  13. BOOL canOpenSettings = (UIApplicationOpenSettingsURLString != NULL);
  14. if (canOpenSettings)
  15. {
  16. NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
  17. [[UIApplication sharedApplication] openURL:url];
  18. }
  19. }
  20. @catch (NSException *exception)
  21. {
  22.  
  23. }
  24. }]];
  25. [self.view presentViewController:alertController animated:YES completion:^{}];
  26. }
Add Comment
Please, Sign In to add comment