ios 调用系统设置,并进入相关的设置项

应用程序调用系统设置,并进入相关的设置项

 

1.在iOS 5.1以前

可以使用URLs schemes,直接用openURL:打开

例如:

NSURL*url=[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];

[[UIApplication sharedApplication] openURL:url];

 

prefs:root=LOCATION_SERVICES 这就是URL 打开位置服务

相应的打开其他的  可搜素关键词”iOS 调用系统设置”

或者

请见:

1.http://stackoverflow.com/questions/8246070/ios-launching-settings-restrictions-url-scheme?rq=1

2.http://blog.sina.com.cn/s/blog_983ef3f201011zel.html

 

2.在iOS 5.1以后 

此方法被移除 详细:http://www.idownloadblog.com/2011/11/29/iphone-5-1-disables-shortcuts/

 

需要手动设置URL shcemes

 

如图:

 

详细:http://stackoverflow.com/questions/8246070/ios-launching-settings-restrictions-url-scheme?rq=1

 

 

 

3.iOS 8 以后  

方法一:以上方法可用(测试环境:Xcode6.4 iOS8.4)

 

方法二:URL  换成UIApplicationOpenSettingsURLString字段

此方法只能进入设置 不能进入更深一层的界面

详细: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/doc/constant_group/Settings_Launch_URL

 

4’其中prefs 更改为app-settings 也可进入设置 但不能更深入

 

参考链接:

http://stackoverflow.com/questions/4496813/call-the-official-settings-app-from-my-app-on-iphone

 

http://stackoverflow.com/questions/8246070/ios-launching-settings-restrictions-url-scheme?rq=1

 

http://stackoverflow.com/questions/8246070/ios-launching-settings-restrictions-url-scheme

 

http://www.idownloadblog.com/2011/11/29/iphone-5-1-disables-shortcuts/

 

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/doc/constant_group/Settings_Launch_URL

原文地址:https://www.cnblogs.com/bad-heli/p/4635453.html