原有方法在ios 10已经失效
NSURL *url1 = [NSURL URLWithString:@"prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url1])
{
[[UIApplication sharedApplication] openURL:url1];
}
有效方法1:
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
有效方法2:
NSURL *url1 = [NSURL URLWithString:@"App-prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url1])
{
[[UIApplication sharedApplication] openURL:url1];
}
网友评论