通过iPhone上的“我的应用”调用官方*Settings*应用

通过iPhone上的“我的应用”调用官方*Settings*应用,iphone,objective-c,settings,url-scheme,Iphone,Objective C,Settings,Url Scheme,在我的应用程序中,我想将用户重定向到官方设置应用程序。如果可能,我还想直接进入设置应用程序中的网络部分 我想我需要的是设置应用程序的url方案和构造请求的格式。但我怀疑调用这样的官方应用程序是被禁止的 有人能帮我吗?如下面的评论所述,这在iOS 5.1及更高版本中不再可能 如果您使用的是iOS 5.0,则以下情况适用: 这在iOS 5中现在可以使用“prefs:”url方案。它可以通过网页或应用程序工作 示例URL: prefs:root=General prefs:root=General&a

在我的应用程序中,我想将用户重定向到官方设置应用程序。如果可能,我还想直接进入设置应用程序中的网络部分

我想我需要的是设置应用程序的url方案和构造请求的格式。但我怀疑调用这样的官方应用程序是被禁止的


有人能帮我吗?

如下面的评论所述,这在iOS 5.1及更高版本中不再可能

如果您使用的是iOS 5.0,则以下情况适用:

这在iOS 5中现在可以使用“prefs:”url方案。它可以通过网页或应用程序工作

示例URL:

prefs:root=General
prefs:root=General&path=Network
示例用法:

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

坏消息:正如@Hlung和@jasongregori所建议的,对于操作系统版本=iOS 5.1和的iDevices,再次出现了没有官方/文档记录的方式从第三方应用程序调用内置设置应用程序。句号。

从IOS 8,您可以使用以下命令从应用程序内调用设置:


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

只能从iOS 8从其他应用程序调用设置应用程序。因此,请使用以下代码

if([CLLocationManager locationServicesEnabled]&&
   [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied)
{
  //...Location service is enabled
}
else
{
    if([[[UIDevice currentDevice] systemVersion] floatValue]<8.0)
    {
      UIAlertView* curr1=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
      [curr1 show];
    }
    else
    {
       UIAlertView* curr2=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil];
       curr2.tag=121;
       [curr2 show];
    }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
   if (alertView.tag == 121 && buttonIndex == 1)
 {
  //code for opening settings app in iOS 8
   [[UIApplication sharedApplication] openURL:[NSURL  URLWithString:UIApplicationOpenSettingsURLString]];
 }
}
if([CLLocationManager LocationServiceEnabled]&&
[CLLocationManager授权状态]!=kCLAuthorizationStatusDenied)
{
//…已启用位置服务
}
其他的
{

如果来自iOS 8的([[[UIDevice currentDevice]systemVersion]floatValue],则可以使用重定向

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

享受编码的乐趣

在iOS版本>5.1中也可以使用,但您必须在Xcode中的URL类型中添加URL方案:

然后你可以用

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
它可以打开系统WiFi设置 现在


请在此答案中找到其他路径:。

只是要添加到地址iOS8+上的附加答案。如果您支持8以下的任何内容,请检查是否支持它

BOOL canGoToSettings = (UIApplicationOpenSettingsURLString != NULL);
if (canGoToSettings)
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}

对于iOS 9中的设置,这对我很有用

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Settings"]];
但请确保在中的url类型中添加url方案


应用程序目标中的信息选项卡。

对于iOS 10,您可以使用:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Settings"]];

它也在iOS 9上运行!

没有这样的URL方案(针对普通公众)。现在在iOS5中有了,请看下面我的答案。你能链接一下文档吗?什么确保它是公开的?谢谢。在这个问题中找到设置应用程序的已知URL列表:dude,你太棒了!经过一番探索后,我找到了一个用于twitter设置的URL:
prefs:root=twitter
知道这些调用是否被归类为“und”吗记录了“?我在文档中找不到它们。你是怎么找到它们的?干杯,@MattyG是的,当然。事实上,我刚刚读到这篇文章说这些在iOS 5.1中不再有效:只是一个善意的警告,说iOS设置的所有url方案都将在iOS 5.1中删除(因此像
prefs:root=General&path=Network
这样的url将不再有效)所以,请注意。iOS 7的解决方案是什么?我同意这一点,我也不能打这个电话。但一些应用程序仍在打这个电话(我正在运行iOS 6.1),就像你在飞行模式下的Twitter和Flipboard…他们是如何做到的?@Omer此解决方案不适用于iOS 10。我正在使用Xcode 8,swift 3。是否有其他解决方案?上面的一行指向应用程序私人设置。是否有任何方法指向设备设置的隐私部分?如果你知道,请发表评论。这是redirection是可能的,正如我在地图应用程序中看到的,它指向隐私部分的位置设置。非常感谢,这正是我要找的!@MichaelDorner--苹果不会拒绝它,对吗?@Anton--苹果不会拒绝它,对吗?@iOSAppDev不幸的是,在发布iOS10时,这不再有效。But以前的版本已成功上载到AppStore。@安东非常感谢您的确认。我非常高兴您回复了我。谢谢:)