从iOS 11中的应用程序打开“设置”应用中的特定项目 [英] Open specific item in Settings app from my app in iOS 11

查看:159
本文介绍了从iOS 11中的应用程序打开“设置”应用中的特定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究了几个答案,但没有发现任何适用于iOS 11的答案。

I have studied several answers and haven't found any that would work for iOS 11.

我想展示切换背景应用程序刷新的方法用户。要做到这一点
我想从我的应用程序打开设置/常规/后台应用刷新菜单。
以下代码仅打开设置应用的根菜单。

I want to show the way to switch Background App Refresh on for my user. To do that I want to open Settings/General/Background App Refresh menu from my app. The following code only opens root menu of the Settings app.

guard let url = URL(string: "App-Prefs:root=General&path=BACKGROUND_APP_REFRESH") else { return }

UIApplication.shared.open(url, options: [:], completionHandler: nil)

Apple有什么方法可以做到这一点?

Is there any way that would be allowed by Apple to do that?

推荐答案

如果您打开URL UIApplicationOpenSettingsURLString 然后您将获得应用的设置,其中包括后台应用刷新功能。

If you open the URL UIApplicationOpenSettingsURLString then you'll be taken your app's settings, which includes background app refresh.

这篇关于从iOS 11中的应用程序打开“设置”应用中的特定项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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