Di *_* Wu 46 iphone settings objective-c url-scheme
在我的应用程序中,我想将用户重定向到官方设置应用程序.如果可能,我还想直接进入" 设置"应用中的" 网络"部分.
我认为我需要的是设置应用的网址方案和构建我的请求的格式.但我怀疑是否禁止使用这样的官方应用程序.
任何人都可以帮助我吗?
mat*_*orb 44
如下面的评论中所述,在iOS 5.1及更高版本中不再可能.
如果您使用的是iOS 5.0,则以下内容适用:
现在可以在iOS 5中使用'prefs:'url方案.它适用于网页或应用程序.
示例网址:
prefs:root=General
prefs:root=General&path=Network
Run Code Online (Sandbox Code Playgroud)
样品用量:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]]
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]]
Run Code Online (Sandbox Code Playgroud)
小智 35
从IOS 8开始,您可以通过以下方式从应用程序中调用设置:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Sle*_*mon 17
它也适用于iOS版本> 5.1,但您必须在Xcode中的URL类型中添加URL方案:

然后你可以使用
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
Run Code Online (Sandbox Code Playgroud)
它现在可以打开系统WiFi设置.
其他路径请在此答案中找到:iOS启动设置 - >限制URL方案.
Di *_* Wu 15
坏消息:正如@Hlung和@jasongregori所建议的那样,对于操作系统版本> = iOS 5.1 && <iOS 8.0的 iDevices,再次没有官方/文档方式从第三方应用程序调用内置的设置应用程序.期.
Tej*_*ina 13
只能从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]];
}
}
Run Code Online (Sandbox Code Playgroud)
从iOS 8开始,您可以重定向
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Run Code Online (Sandbox Code Playgroud)
喜欢编码
| 归档时间: |
|
| 查看次数: |
41182 次 |
| 最近记录: |