如何在Facebook应用程序中以编程方式打开设置? [英] How to open Settings programmatically like in Facebook app?

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

问题描述

我需要在我的应用程序中以编程方式打开设置。我搜遍了SO,但到处都有人说这是不可能的。但今天我看到它在Facebook应用程序中实现。 UIAlertView 上有一个按钮,当您单击它时,您打开设置。所以确实可以打开设置,我亲眼目睹了这一点。但是怎么做呢?有谁知道Facebook是如何做到的?

I need to open Settings programmatically from within my app. I searched across SO but everywhere people say that it's impossible. But today I saw that it's implemented in Facebook app. There's a button on an UIAlertView and when you click it you open the Settings. So indeed this is possible to open Settings, I have witnessed this myself. But how to do that? Does anyone know how Facebook does that?

推荐答案

你不能,没有API调用来做到这一点。

You can't, there is no API call to do this.

只有系统对话框,来自Apple Frameworks的对话框才能打开设置应用程序。
在iOS 5中有一个应用程序网址方案来打开系统对话框,但Apple稍后将其删除。

Only system dialogs, dialogs from Apple Frameworks, can open the settings app. In iOS 5 there was a app url scheme to open the system dialog but Apple removed it later.

随着iOS 8的推出,您可以在应用页面上打开设置对话框。

With the coming of iOS 8 you can open the settings dialog on your apps page.

if (&UIApplicationOpenSettingsURLString != NULL) {
   NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
    [[UIApplication sharedApplication] openURL:url];
}
else {
  // Present some dialog telling the user to open the settings app.
}

这篇关于如何在Facebook应用程序中以编程方式打开设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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