如何以编程方式打开设置应用程序? [英] How to open settings app programmatically?

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

问题描述

我在ios 8.3中使用了swift.我想从我的应用程序中打开设置应用程序.我知道使用代码

I'm using swift with ios 8.3. I want to open settings app from my application. I know that using the code

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

将打开我的应用程序设置.但是我不想打开我的应用程序设置.我只想打开设置应用程序并停留在主页上.如果可能,请导航到蜂窝".有什么办法可以做到这一点?

will open my app settings. But I don't want to open my app settings. I just want to open the settings app and stay in the main page. If possible, navigate to "Cellular". Is there any way to acheive this?

推荐答案

尝试一下.

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

Xcode 8.2.1-iOS 10

Xcode 8.2.1 - iOS 10

这篇关于如何以编程方式打开设置应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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