简体   繁体   English

在特定部分打开iOS设置应用

[英]Open iOS Settings App in Specific Section

I am aware of this 我知道这个

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

which opens Settings App and takes you directly to the settings related to YOUR app. 这会打开“设置”应用,并直接将您带到与您的应用相关的设置。 But I would like to go to a specific section in the Settings app. 但我想转到“设置”应用中的特定部分。 For my case, I specifically would like to open Settings -> Privacy -> Location Services. 就我而言,我特别想打开设置->隐私->位置服务。 How can I achieve this? 我该如何实现?

You have to take three separate steps to allow your app to open specific sections in Settings. 您必须采取三个单独的步骤,以允许您的应用打开“设置”中的特定部分。

First, open up the Info section of a project's target. 首先,打开项目目标的“ Info部分。 Then expand the URLTypes section at the bottom. 然后,展开底部的URLTypes部分。 Add prefs to the URL Schemes textbox prefs添加到“ URL方案”文本框中

在此处输入图片说明

Next, put this code in your app where you want the specific section of Settings to open. 接下来,将此代码放在您要打开“设置”特定部分的应用中。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"prefs:root=General&path=About"]]

Finally, change the text in the URL string to indicate the section you want -- here's the list of possibilities: 最后,更改URL字符串中的文本以指示所需的部分-这是可能性的列表:

prefs:root=General&path=About
prefs:root=General&path=ACCESSIBILITY
prefs:root=AIRPLANE_MODE
prefs:root=General&path=AUTOLOCK
prefs:root=General&path=USAGE/CELLULAR_USAGE
prefs:root=Brightness
prefs:root=General&path=Bluetooth
prefs:root=General&path=DATE_AND_TIME
prefs:root=FACETIME
prefs:root=General
prefs:root=General&path=Keyboard
prefs:root=General&path=INTERNATIONAL
prefs:root=LOCATION_SERVICES
prefs:root=ACCOUNT_SETTINGS
prefs:root=MUSIC
prefs:root=MUSIC&path=EQ
prefs:root=MUSIC&path=VolumeLimit
prefs:root=General&path=Network
prefs:root=NIKE_PLUS_IPOD
prefs:root=NOTES
prefs:root=NOTIFICATIONS_ID
prefs:root=Phone
prefs:root=Photos
prefs:root=General&path=ManagedConfigurationList
prefs:root=General&path=Reset
prefs:root=Sounds&path=Ringtone
prefs:root=Safari
prefs:root=General&path=Assistant
prefs:root=Sounds
prefs:root=General&path=SOFTWARE_UPDATE_LINK
prefs:root=STORE
prefs:root=TWITTER
prefs:root=FACEBOOK
prefs:root=General&path=USAGE prefs:root=VIDEO
prefs:root=General&path=Network/VPN
prefs:root=Wallpaper
prefs:root=WIFI
prefs:root=INTERNET_TETHERING`

It looks like prefs:root=LOCATION_SERVICES is the one you'd want. 看起来像是prefs:root=LOCATION_SERVICES是您想要的那个。 Plus, this will only work for iOS 8 and higher. 另外,这仅适用于iOS 8及更高版本。

Edited to Add: This information is not official and is not supported by Apple in their documentation. 编辑添加: 此信息不是官方的,Apple的文档也不支持此信息。 This code may break in future iOS releases and may cause issues with App Store review. 此代码可能会在将来的iOS版本中中断,并可能导致App Store审核出现问题。

GlennRay's answer is correct in implementation but just to add a little more info. GlennRay的答案在实现上是正确的,只是增加了一些信息。

https://developer.apple.com/library/content/qa/qa1924/_index.html https://developer.apple.com/library/content/qa/qa1924/_index.html

Apple specifically state that only the keyboard settings is supported and all other values to open to a specific section are a violation of the App Review guidelines. Apple特别声明仅支持键盘设置,而所有其他要打开到特定部分的值均违反了App Review指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在应用程序中打开特定部分的链接(android和ios) - A link to open a specific section in the app(android and ios) iOS:打开我的应用特定位置设置 - iOS : Open my App Specific Location Settings 在iOS 11中通过我的应用程序在“设置”应用程序中打开特定项目 - Open specific item in Settings app from my app in iOS 11 从应用程序打开iOS设置 - Open iOS settings from the app 在Swift中的iOS应用中,如何打开Facebook应用到个人资料页面的特定部分 - From iOS app in Swift, how to open facebook app to specific section of profile's page 从另一个应用程序ios链接到设置应用程序的声音部分 - Link to the sound section of the settings app from another app ios 如何从iOS 8中的应用程序打开常规设置(不在应用程序设置中)? - How to open general settings (not in the app settings) from the app in iOS 8? 特定设置部分的iOS 11 URL方案已停止工作 - iOS 11 URL Scheme for specific Settings section stopped working 以编程方式导航到iOS主要设置应用,而不是应用特定设置页面 - Programmatically navigate to iOS main settings app, not the app specific settings page 通过UIAlertView调用iOS Settings App的iCloud部分 - Calling the iCloud Section of iOS Settings App Through a UIAlertView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM