问题
My app uses a URL scheme to take users directly to Settings/General/About section, the following URL was working fine in 10.3.x.
"App-Prefs:root=General&path=About"
However, this URL scheme no longer works in iOS 11 GM build. It only launches the Settings app, but doesn't take user any further. Does anybody know if this is expected in iOS 11 official release? Thanks in advance.
回答1:
let url = NSURL(string: "app-settings:root=Privacy&path=LOCATION")! as URL
UIApplication.shared.open(url, options: [:], completionHandler: nil)
It works fine for me, iOS11 both on iPhone device and simulator.
"App-Prefs:" change to "app-settings:" then will work.
回答2:
This no longer works since iOS 11.
Here are the only things you can do currently:
Open the Settings app (whatever's written after the :
is ignored)
UIApplication.shared.open(URL(string: "App-prefs:")!)
Open your App settings
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
回答3:
I don't have a working solution, but found something interesting. The following two URL schemes will both launch the Settings app.
"App-Prefs:" "app-settings:"
So it looks like iOS is ignoring root=xyz&path=123 altogether...
回答4:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
this may be better than "app-settings" However, I need to open the system location enable setting, looked like this cannot be resolved anymore at iOS 11
回答5:
After receiving some new suggestions, I believe the best we can do in iOS11
is to take user directly to the app's own section in Settings with the code below:
In Objective-C:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
I tried this on my iPhone SE and was able to launch into app's own settings section.
回答6:
I use "app-settings:root=Privacy&path=LOCATION
" work fine in iOS8、iOS9、iOS10 and iOS1. It's really good solution.
来源:https://stackoverflow.com/questions/46253781/ios-11-url-scheme-for-specific-settings-section-stopped-working