如何在设置iOS 11中打开您的应用 [英] How to open your app in Settings iOS 11

查看:51
本文介绍了如何在设置iOS 11中打开您的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎苹果已将许多应用程序配置移至iOS 11的应用程序路径中,如何在设置"中以编程方式打开应用程序路径?我尝试了"App-Prefs:root = \(Bundle.main.bundleIdentifier!)" ,但这似乎不起作用.

It seems that Apple has moved a lot of the app configurations to the App path with iOS 11, how to open the app path programmatically in Settings? I tried "App-Prefs:root=\(Bundle.main.bundleIdentifier!)" but this doesn't seem to work.

请注意,我的问题特定于:如何在设置中打开应用程序路径:如何打开设置

Please note that my question is specific to: How to open the app path in settings: NOT how to open the settings

推荐答案

我想这是您正在寻找的代码:

Here is the code you're looking for, I guess:

if let url = URL(string: UIApplicationOpenSettingsURLString) {
    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
}

此外,Swift 5的更新版本:

And in addition, the updated version for swift 5 :

if let url = URL(string: UIApplication.openSettingsURLString) {
    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
}

这篇关于如何在设置iOS 11中打开您的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆