在ios之前,跳转到手机对应页面代码为:
NSURL *url = [NSURL URLWithString:@"prefs:root=WIFI"];
[[UIApplication sharedApplication] openURL:url];
但是当ios10之后,发现此代码跳转无效果
ios10之后方法为
一:在info.plist里面设置URL Schemes为Prefs,切记P为大写
二:// 我这里是跳转到“系统设置”->“通知”界面。
NSURL*url=[NSURL URLWithString:@"Prefs:root=Privacy&path=LOCATION"];
// !!!关键代码!!!跟之前的写法也不一样了!!!
Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace"); [[LSApplicationWorkspace performSelector:@selector(defaultWorkspace)] performSelector:@selector(openSensitiveURL:withOptions:) withObject:url withObject:nil];
- (void)defaultWorkspace{}
- (BOOL)openSensitiveURL:(id)arg1 withOptions:(id)arg2{
return YES;
}