URL方案"prefs:root = PASS"; iOS10 [英] URL scheme "prefs:root=PASS" iOS10
问题描述
我知道有关此问题的话题很多,但是有解决方案吗?我还没有找到官方文档.
I know there are lot of topics about this problem but is there a solution? I have not found official documentation for that.
我的问题是我需要在存储设置上重定向我的代码,例如:(在iOS 9中工作)
My problem is I need to redirect my code on storage settings like this : (work in iOS 9)
let settingsUrl = NSURL(string: "prefs:root=CASTLE&path=STORAGE_AND_BACKUP")
if let url = settingsUrl {
UIApplication.shared.openURL(url as URL)
}
但是由于ios10这种方法不起作用,所以有替代方法吗?我看到了SnapChat,Google Maps将其应用重定向到设置的不同部分(而不是设置的主屏幕),所以我认为有解决方案.
But since ios10 this method don't work, so Is there an alternative? I saw SnapChat, Google Maps redirect their apps to different part on settings (not the main screen of settings) so I think there is a solution.
我已经在info.plist中实现了url方案,但仍然无法正常工作
I already implement the url scheme in info.plist but it's still not work
我尝试了这种方法,但同样存在问题
I tried this method but same issue too
let settingsUrl = NSURL(string: "prefs:root=CASTLE&path=STORAGE_AND_BACKUP")
if let url = settingsUrl {
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL.init(string:"Prefs:root=General&path=STORAGE_ICLOUD_USAGE/DEVICE_STORAGE")!, options: [UIApplicationOpenURLOptionUniversalLinksOnly:true], completionHandler:{(success: Bool?) -> Void in})
} else {
UIApplication.shared.openURL(url as URL)
}
}
先谢谢.
推荐答案
从iOS 10开始,无法从第三方应用程序打开Settings
应用程序.唯一可以打开的设置是键盘设置",但只能通过自定义键盘扩展名和您自己的应用程序设置来打开.
更多详细信息:此处
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
注意:即使对于iOS 9,使用问题中提到的URL字符串也可能导致应用被拒绝,因为它违反了
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.
这篇关于URL方案"prefs:root = PASS"; iOS10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!