我知道一个应用程序可以使用此代码启动其他应用程序:[[UIApplication sharedApplication] openURL:appUrl];
。我知道打开safari和邮件的URL方案,但是我做了一些搜索,并没有发现任何关于settings.app的方案。是否可以使用openURL打开设置应用程序?
22
A
回答
16
您可以在iOS 5.0 - 5.0.1版本中使用它。它在iOS 5.1中被弃用。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];
+24
不再适用于iOS 5.1。 – mrueg 2012-03-31 16:31:20
31
您可以打开设置应用程序试试这个(只能从iOS8上起)。
如果您使用的斯威夫特:
UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString))
如果您正在使用的Objective-C
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
较低的其他版本(小于iOS8上)其不可能以编程方式打开设置应用。
3
开放设置应用程式编程是可能仅从的iOS 8.所以,从使用以下代码http://code-ios.blogspot.in/2014/10/opening-settings-app-from-another-app.html
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
{
NSLog(@"buttonIndex:%d",buttonIndex);
if (alertView.tag == 121 && buttonIndex == 1)
{
//code for opening settings app in iOS 8
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
}
0
夫特4版本:的
if let url = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.openURL(url)
}
相关问题
- 1. 是否可以使用window.open打开sapui5应用程序?
- 2. 是否可以通过编程方式打开设置应用程序? (未设置应用程序内的应用程序设置)
- 3. 是否可以远程打开我的iOS应用程序?
- 4. 可以从我的应用程序打开设置应用程序?
- 5. 我可以从我的应用程序打开设置应用程序吗?
- 6. 是否可以从本机应用程序打开addContactScreen?
- 7. 测试应用程序是否可以打开特定类型?
- 8. Flex FileReference.download - 是否可以打开相关应用程序
- 9. 设置链接打开应用程序
- 10. 打开设置应用程序?
- 11. 是否可以使用Maven开发前端/ Web应用程序?
- 12. 是否可以使用JavaFX API开发Web应用程序?
- 13. 是否可以使用Phonegap开发全屏iPad应用程序?
- 14. 是否可以在Google应用程序引擎应用程序上设置xrebel,以及如何进行设置?
- 15. 是否可以从设置应用程序检索数据?
- 16. 是否可以在iBeacon应用程序上动态设置UUID?
- 17. 您是否可以使用xcode为1个设备开发应用程序?
- 18. 以编程方式打开设置应用程序(iPhone)
- 19. 是否可以设置Android应用程序连接到开发服务器?
- 20. 是否可以为Android应用程序设置一个开放的URI?
- 21. 在设置应用程序中打开应用程序的通知设置
- 22. 如何在应用程序打开时更改应用程序设置(设置)?
- 23. 使用openurl时,设置应用程序捆绑软件未显示在设置应用程序中
- 24. 您是否可以在其他应用程序中打开应用程序,而不使用URL方案?
- 25. UIApplication openURL:打开之前检查应用程序?
- 26. 是否可以在应用程序设置中使用自定义枚举? (VS10)
- 27. 是否可以创建可以打开两个不同用户配置文件的Java应用程序?
- 28. 是否可以更改设备设置仅适用于我的应用程序?
- 29. Cocoa API设置文件的默认应用程序以打开
- 30. 你可以使用OpenURL打开原生iPhone邮件应用程序,但不能撰写?
可能重复的[打开设置应用从另一个应用程序](http://stackoverflow.com/questions/5655674/opening-the-settings-app-from-another-app) – Flexo 2011-10-15 21:08:40
我认为[这个问题](http://stackoverflow.com/questions/377102 /怎么办-I-开放的 - 设置 - 应用程序 - FR om-my-application)回答它。 – 2009-07-07 05:12:29
检查答案:http://stackoverflow.com/questions/28152526/how-do-i-open-phone-settings-when-a-button-is-clicked-ios/34024467#34024467 – 2015-12-01 16:00:33