settings – UIApplicationOpenSettingsURLString not work in iOS 10

settings – UIApplicationOpenSettingsURLString not work in iOS 10

I did like that and its works. Im test it today!

 NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
 [[UIApplication sharedApplication] openURL:url];

Swift 3:

let urlObj = NSURL.init(string:UIApplicationOpenSettingsURLString)
if #available(iOS 10.0, *) {
    UIApplication.shared.open(urlObj as! URL, options: [ : ], completionHandler: { Success in

     })
} else {
      let success = UIApplication.shared.openURL(url as URL)
      print(Open (url): (success))                            
}

Swift 4

if let url = URL(string: UIApplicationOpenSettingsURLString) {
   if UIApplication.shared.canOpenURL(url) {
      _ =  UIApplication.shared.open(url, options: [:], completionHandler: nil)
   }
}

settings – UIApplicationOpenSettingsURLString not work in iOS 10

For iOS 11 +

UIApplication *application = [UIApplication sharedApplication];
NSURL *URL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[application openURL:URL options:@{} completionHandler:^(BOOL success) {
    if (success) {
        NSLog(@Opened url);
    }
}];

Leave a Reply

Your email address will not be published. Required fields are marked *