Before I asked this question I had try:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Privacy&path=LOCATION"]];
It's work fine on iOS8 and iOS9,but there is nothing happen on iOS10.[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
It's work fine on iOS8 and iOS9,too.However,on iOS10,when the app jump to system setting, the system setting exit immediately.[[UIApplication sharedApplication]openURL:url options:@{}completionHandler:nil];
It's crashed on iOS8 and iOS9,also,exit immediately on iOS10.The question is can our app jump to system setting on iOS10? If yes.How?And for [[UIApplication sharedApplication]openURL:url options:@{}completionHandler:nil];
what's the options
means?We must code something for the options
?
For some time now, apps have only been permitted to open their own settings pane in the settings app. There have been various settings URLs that have worked in the past, but recently Apple has been rejecting apps that use these URLS.
You can open your own application's settings:
if let url = URL(string:UIApplicationOpenSettingsURLString) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
Or in Objective-C
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if (url != nil) {
[[UIApplication sharedApplication] openURL:url options:[NSDictionary new] completionHandler:nil];
}
If you are targeting version of iOS earlier than 10 then you may prefer to use the older, deprecated, but still functional method:
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if (url != nil) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[[UIApplication sharedApplication] openURL:url];
#pragma clang diagnostic pop
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With