从另一个应用程序打开设置应用程序 [英] Opening the Settings app from another app

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

问题描述

好吧,我知道有很多关于它的问题,但它们都是很久以前的.

Okay, I know that there are many question about it, but they are all from many time ago.

所以.我知道这是可能的,因为地图应用程序做到了.

So. I know that it is possible because the Map app does it.

在地图应用程序中,如果我关闭此应用程序的本地化,它会向我发送一条消息,如果我按确定,设置应用程序"将打开.我的问题是,这怎么可能?如何从我自己的应用中打开设置应用"?

In the Map app if I turn off the localization for this app, it send me a message, and if I press okay, the "Settings App" will be open. And my question is, how is this possible? How can I open the "Setting app" from my own app?

基本上我需要做同样的事情,如果用户关闭我的应用程序的位置,那么我会向他显示一条消息,说明将打开设置应用程序"

Basically I need to do the same thing, if the user turn off the location for my app, then I'll show him a message saying something that will open the "Setting app"

推荐答案

正如 Karan Dua 所提到的,这是 现在可以在 iOS8 中使用 UIApplicationOpenSettingsURLString代码> 参见 Apple 的文档.

As mentioned by Karan Dua this is now possible in iOS8 using UIApplicationOpenSettingsURLString see Apple's Documentation.

示例:

Swift 4.2

UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)

在 Swift 3 中:

UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!)

在 Swift 2 中:

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

在 Objective-C 中

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

iOS 8 之前:

你不能.正如您所说,这已被多次提及,并且要求您打开定位服务的弹出窗口是由 Apple 提供的,而不是由应用程序本身提供的.这就是为什么它能够打开设置应用程序.

You can not. As you said this has been covered many times and that pop up asking you to turn on location services is supplied by Apple and not by the App itself. That is why it is able to the open the settings application.

这里有一些相关的问题&文章:

Here are a few related questions & articles:

是否可以使用 openURL 打开设置应用程序?

以编程方式打开设置应用程序 (iPhone)

我该怎么办当用户按下按钮时打开设置"应用?

iPhone:从应用程序打开应用程序首选项面板

通过以下方式打开 UIPickerView单击应用首选项中的条目 - 如何?

打开设置应用程序?

iOS:您的设置有误

这篇关于从另一个应用程序打开设置应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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