简体   繁体   English

特定设置部分的iOS 11 URL方案已停止工作

[英]iOS 11 URL Scheme for specific Settings section stopped working

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. 我的应用程序使用URL方案将用户直接带到Settings / General / About部分,以下URL在10.3.x中正常工作。
"App-Prefs:root=General&path=About" “应用程序 - 偏好设置:根=通用及路径=关于”

However, this URL scheme no longer works in iOS 11 GM build. 但是,此URL方案不再适用于iOS 11 GM构建。 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? 有人知道iOS 11正式发布中是否有这种情况? Thanks in advance. 提前致谢。

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. 它适用于我,iOS11在iPhone设备和模拟器上。

"App-Prefs:" change to "app-settings:" then will work. “App-Prefs:”更改为“app-settings:”然后就可以了。

This no longer works since iOS 11. 这不再适用于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. 以下两个URL方案都将启动“设置”应用。

"App-Prefs:" "app-settings:" “App-Prefs:”“app-settings:”

So it looks like iOS is ignoring root=xyz&path=123 altogether... 所以看起来iOS完全忽略了root = xyz&path = 123 ......

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

这可能比“app-settings”更好但是,我需要打开系统位置启用设置,看起来这样无法在iOS 11中解决

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: 在收到一些新建议之后,我相信我们在iOS11可以做的最好的iOS11就是将用户直接带到设置中应用程序自己的部分,其代码如下:

In Objective-C: 在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. 我在我的iPhone SE上尝试了这个,并且能够启动到应用程序自己的设置部分。

I use " app-settings:root=Privacy&path=LOCATION " work fine in iOS8、iOS9、iOS10 and iOS1. 我使用“ app-settings:root=Privacy&path=LOCATION ”在iOS8,iOS9,iOS10和iOS1中正常工作。 It's really good solution. 这是非常好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM