How can I open the Settings app when the user presses a button?(用户按下按钮时如何打开设置应用程序?)
问题描述
据我了解,使用这样的代码:
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 设置屏幕
这篇关于用户按下按钮时如何打开设置应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用户按下按钮时如何打开设置应用程序?


基础教程推荐
- :hover 状态不会在 iOS 上结束 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01