URL方案“打开设置” IOS [英] URL Scheme "Open Settings" ios

查看:176
本文介绍了URL方案“打开设置” IOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题被问了很多次。答案说这在Xcode> 5.x中不可用。但我看到一些可以使用它的应用程序(转到设置)(iOS7)。有没有办法做到这一点?它在Xcode 6中可用吗? Facebook 可以检测到蜂窝数据和wifi

I know this question has been asked so many times. The answers say that this is not available in Xcode > 5.x. but I saw some apps that can use this(Go to Settings)(iOS7). Is there any way to do this? Is it available in Xcode 6? Facebook can detect both cellular data and wifi.

推荐答案

从iOS 8开始,可以通过这种方式启动直接打开隐私应用程序部分的设置应用程序:

As of iOS 8, it's possible to launch the Settings app that directly opens your Privacy app section in this way:

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

在Swift中:

if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
    UIApplication.sharedApplication().openURL(settingsURL)
}

在Swift 3.0中:

In Swift 3.0:

if let settingsURL = URL(string: UIApplicationOpenSettingsURLString + Bundle.main.bundleIdentifier!) {
    UIApplication.shared.openURL(settingsURL as URL)
}

这篇关于URL方案“打开设置” IOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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