Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [alert addAction:[UIAlertAction
- actionWithTitle:NSLocalizedString(@"Go to Settings", nil)
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action) {
- id observer = [NSNotificationCenter.defaultCenter
- addObserverForName:UIApplicationWillEnterForegroundNotification
- object:nil queue:nil
- usingBlock:^(NSNotification *note) {
- dispatch_async(dispatch_get_main_queue(), completion);
- [NSNotificationCenter.defaultCenter removeObserver:observer];
- }];
- if (![UIApplication.sharedApplication openURL:settingsURL]) {
- completion();
- [NSNotificationCenter.defaultCenter removeObserver:observer];
- }
- }]];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement