UIApplicationOpenSettingsURLString not work in iOS 10

12,070

Solution 1

I did like that and it's works. I'm 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)")                            
}

Solution 2

Swift 4

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

ratkevich

Updated on June 23, 2022

Comments

  • ratkevich
    ratkevich almost 2 years

    In iOS 10, do not open settings url:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    

    What is the problem?

  • ratkevich
    ratkevich over 7 years
    Yes, it works! Just in the program did not have the settings and opens the desktop.
  • ArtStyle
    ArtStyle over 7 years
    It just opens the empty grey screen with no 'full access switch'