欢迎访问 水平网    今天是:2018年06月22日 注册 | 登录 | 订阅 | 收藏
>> 苹果【Apple】 >> 编程应用 >> IOS应用内跳转到系统设置界面
推荐文章
热点文章

IOS应用内跳转到系统设置界面

作者:未知,  来源:网络,  阅读:1071,  发布时间:2014-05-19  【放入收藏夹

使用方法:
Objective-c代码
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Keyboard"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Keyboard"]];

然而不幸的是,ios 5.1之后系统不再支持这些url跳转调用到系统。

引用

Yep, saw this (and many more), even implemented it in a test application. Really need to get the definative word from APPL, but the community concensus opinion is APPL disallowed it in 5.1 after it was publically "discovered/published", so applications containing it won't be accepted.

08/01/12 Update: Asked Apple through my developer account if there is a way to programmatically launch the WiFi Settings dialog. Here is the response:

"Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations."

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

所以,要么我们干脆干掉这个功能。要么,变态了。

Objective-c代码
- (void) showLocationAlert {

if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) {

//Check whether Settings page is openable (iOS 5.1 not allows Settings page to be opened via openURL:)
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service,Turn on location service to allow "YourApp" to determine your location" delegate:self cancelButtonTitle:@"Settings" otherButtonTitles:@"Cancel", nil];
[alert show];

}
else {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alert show];
}
}
}

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];
}

}

TGAS:IOS
评论【共有0条评论】查看所有评论
昵称:(*)   邮箱:   QQ:   验证码: 看不清楚?点击刷新验证码