从其他应用打开“设置”应用 [英] Opening the Settings app from another app
问题描述
好的,我知道有很多问题,但它们都来自很久以前。
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"
我非常感谢您的回答,我的意思是。
I really appreciate your answers, I mean it.
推荐答案
如 Karan Dua所述这是现在可以在iOS8中使用使用 UIApplicationOpenSettingsURLString
参见 Apple的文档。
示例:
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:
Open UIPickerView by clicking on an entry in the app's preferences - How to?
这篇关于从其他应用打开“设置”应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!