Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. [alert addAction:[UIAlertAction
  2. actionWithTitle:NSLocalizedString(@"Go to Settings", nil)
  3. style:UIAlertActionStyleDefault
  4. handler:^(UIAlertAction *action) {
  5. id observer = [NSNotificationCenter.defaultCenter
  6. addObserverForName:UIApplicationWillEnterForegroundNotification
  7. object:nil queue:nil
  8. usingBlock:^(NSNotification *note) {
  9. dispatch_async(dispatch_get_main_queue(), completion);
  10. [NSNotificationCenter.defaultCenter removeObserver:observer];
  11. }];
  12. if (![UIApplication.sharedApplication openURL:settingsURL]) {
  13. completion();
  14. [NSNotificationCenter.defaultCenter removeObserver:observer];
  15. }
  16. }]];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement