用户按下按钮时如何打开设置应用程序? [英] How can I open the Settings app when the user presses a button?

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

问题描述

据我了解,使用这样的代码:

From what I understand by using code like this:

NSURL* appUrl = [NSURL URLWithString: @"URL"];
[[UIApplication sharedApplication] openURL:appUrl];

当用户说按下按钮时,我可以打开 Map、YouTube、Safari、Mail、iTunes 和 App Store.

I can open Map, YouTube, Safari, Mail, iTunes and the App Store, when a user say presses a button.

但我想知道是否可以使用这种方法打开设置应用程序.

But I was wondering is it possible to open the Settings app with this method.

基本上,当用户第一次打开我的应用程序时,我希望弹出一个 UIAlertView,让用户知道他们可以根据需要更改特定设置,然后他们按 OK 或按设置将他们带到设置应用程序.

Basically, the first time the user opens my app I want a UIAlertView to pop up to let the user know that they can change a specific setting if they want, and either they press OK or they press settings to take them to the settings app.

我知道 Apple 在某些情况下会这样做,但开发人员可以这样做吗?

I know that Apple do that in some situations, but is it possible for developers to do that?

推荐答案

根据@bnduati 的回答,在iOS 8 中,您可以使用以下代码在设置应用中打开应用的设置:

As per @bnduati's answer, in iOS 8 you can use the following code to open your app's settings in the settings app:

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

<小时>

旧答案:


Old answer:

从 iOS 5.1 到 iOS 7,无法从其他应用程序打开设置应用程序.

From iOS 5.1 through iOS 7, it was not possible to open the settings app from another application.

您可能需要调查此框架以提供应用内设置.

You might want to investigate this framework for providing in-app settings.

还有很多其他问题在讨论这个话题:

There are quite a few other questions that discuss this topic:

iPhone- 如何将通过System Settings App看到的Settings bundle放到自己的App中?

从应用程序启动 iPhone 设置屏幕?

如何从您的 iPhone 应用程序中将用户发送到主 iPhone 设置屏幕

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

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