Open Wifi Settings by "Prefs:Root=Wifi" Failed in iOS 10

How to programmatically open the WIFI settings in Objective-C on iOS 10

This works fine on iOS 10,

Go to Targets --> (Application) --> Info --> URL Types --> +

In the URL Schemes write

prefs

See the image,
Sample Image

Then add the following code,

-(void)openWifiSettings{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"prefs:root=WIFI"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=WIFI"]];
}
}

URL scheme prefs:root=PASS iOS10

Since iOS 10, it's not possible to open the Settings app from a third party app. The only settings that are allowed to be opened are Keyboard setting but only by a custom keyboard extension and your own application settings.
More details: here

Note: Even for iOS 9, using the URL string that is mentioned in the question can lead to app rejection as it violates iOS App Review Guidelines.

window.location.href = prefs:root=Settings not work in iOS 10

Just replace "prefs" to "App-Prefs" for iOS 10

prefs:root=CASTLE not working to open iCloud Settings in IOS10?

For iOS 10 onwards change prefs:root=CASTLE to App-Prefs:root=CASTLE and this will work fine

let settingsCloudKitUrl = URL(string:"App-Prefs:root=CASTLE")
if let url = settingsCloudKitUrl {
if #available(iOS 10, *) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
} else {
UIApplication.shared.openURL(url)
}
}


Related Topics



Leave a reply



Submit