URL Scheme“打开设置"ios [英] URL Scheme "Open Settings" ios

查看:16
本文介绍了URL Scheme“打开设置"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 Scheme“打开设置"ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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