iOS 11 URL Scheme for specific Settings section stopped working

人盡茶涼 提交于 2019-12-02 23:21:54
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.

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)!)

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...

Henry Zhang
[[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

Ben Z.

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.

I use "app-settings:root=Privacy&path=LOCATION" work fine in iOS8、iOS9、iOS10 and iOS1. It's really good solution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!