xcode 在 iPhone SDK 上的 UIAlertView 中点击按钮时打开 Settings.app

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14275314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:29:43  来源:igfitidea点击:

Open Settings.app When Button is Tapped in UIAlertView on iPhone SDK

iphonexcodebuttonsettingsuialertview

提问by jaytrixz

Possible Duplicate:
Opening the Settings app from another app

可能重复:
从另一个应用程序打开设置应用程序

Is there a way to direct the user to the Settings.app whenever I show a UIAlertViewprompt? This prompt alerts the user that his location services is turned off and I want the user to open the Settings.app when he taps the button inside my UIAlertView.

有没有办法在我显示UIAlertView提示时将用户定向到 Settings.app ?此提示提醒用户他的位置服务已关闭,我希望用户在他点击 my 中的按钮时打开 Settings.app UIAlertView

UPDATE: I'm looking for a similar code stated here:

更新:我正在寻找此处所述的类似代码:

How to launch myapplication settings tab in settings app from my application in ipad

如何从我的 ipad 应用程序中的设置应用程序中启动我的应用程序设置选项卡

回答by Midhun MP

iOS 8 and iOS 9

iOS 8 和 iOS 9

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

There is no way to do this.

没有办法做到这一点。

Because till now (11th Jan 2013) there is no url schemeavailable for settings app.

因为到目前为止(2013 年 1 月 11 日)还没有可用于设置应用程序的url 方案

iOS 6

iOS 6

You can't do this on iOS 6.

您不能在 iOS 6 上执行此操作。

iOS 5 and below (< iOS 5.1)

iOS 5 及以下(< iOS 5.1)

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];

Please refer this answer for more info Call the official *Settings* app from my app on iPhone

请参阅此答案以获取更多信息从我的 iPhone 应用程序调用官方 *设置* 应用程序