iOS中的访问设置应用 [英] Access Settings app in iOS

查看:150
本文介绍了iOS中的访问设置应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有机会通过点击按钮在iOS中显示settings.app?它应该适用于iOS 5.1,所以prefs:root ...url是没有选项。

Is there an opportinity to show up the settings.app in iOS by clicking on a button? It should work with iOS 5.1 so the "prefs:root..." url is no option.

你知道如何解决这个问题吗?

Do you have an idea how to solve this?

推荐答案

我知道问题大概就是5.1,但万一其他人有兴趣:

I know the question is about 5.1 specifically, but in case anyone else is interested:

从iOS 8开始,您可以将应用中的用户直接带到设置应用中。它们会深入链接到您应用的特定设置页面,但可以退回到顶级设置屏幕。

As of iOS 8, it is possible to take a user from your app directly into the Settings app. They will be deep linked into your app's specific Settings page, but they can back out into the top level Settings screen.

更新:

感谢Pavel的评论,我简化了if语句并避免了iOS 7上的EXC_BAD_ACCESS。

Thanks to Pavel's comment, I simplified the if statement and avoided the EXC_BAD_ACCESS on iOS 7.

UPDATE 2:

如果您的部署目标设置为8.0或更高,Xcode 6.3会给您以下警告:

If your deployment target is set to 8.0 or above, Xcode 6.3 will give you the following warning:

Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true

这是因为该功能从8.0开始可用,因此该指针永远不会是 NULL 。如果您的部署目标是8.0+,只需删除下面的if语句。

This is because the feature was available starting in 8.0, so this pointer will never be NULL. If your deployment target is 8.0+, just remove the if statement below.

if (&UIApplicationOpenSettingsURLString != NULL) {
    NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
    [[UIApplication sharedApplication] openURL:appSettings];
} 

这篇关于iOS中的访问设置应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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