ios - 从另一个应用程序打开“设置”应用程序

标签 ios objective-c iphone application-settings appsettings

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

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

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

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

最佳答案

Karan Dua 所述这是 now possible in iOS8使用 UIApplicationOpenSettingsURLString 参见 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 而不是应用程序本身提供的。这就是它能够打开设置应用程序的原因。

以下是一些相关的问题和文章:

is it possible to open Settings App using openURL?

Programmatically opening the settings app (iPhone)

How can I open the Settings app when the user presses a button?

iPhone: Opening Application Preferences Panel From App

Open UIPickerView by clicking on an entry in the app's preferences - How to?

Open the Settings app?

iOS: You’re Doing Settings Wrong

关于ios - 从另一个应用程序打开“设置”应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43457919/

相关文章:

iOS - 使用两个不同的 UIButton 左右旋转图层

iphone - 有没有办法在调试时获得完整的 iOS 崩溃日志?

iphone - 带有手势识别器的 hitTest 确认 View 不会收到事件的情况?

ios - 我想在不停止另一个应用程序后台播放音乐的情况下制作音效

ios - 当我不得不查询Apple的反馈服务时

ios - 具有 AVPlayerLayer 'ready to play' 状态的 AVPlayer 无法用于真实的 videoView 显示

ios - 在 UITableView 中单击时更改 UIButton 颜色和文本

iPhone 应用程序 : how to implement Google Places Api

objective-c - TableView 交互阻止单元格中的动画

iphone - 如何在 Objective C 中解析 XML 并生成逗号分隔的字符串