解决iOS10不能跳转系统WiFi列表的问题

来源:互联网 发布:网络推广协议 编辑:程序博客网 时间:2024/05/15 00:05

第一种方式:

在iOS10更新后,系统设置跳转被禁用,只能跳转App设置,但是最近发现苹果又更新了URLscheme,亲测可用,建议iOS10已下,还用原来的scheme

#define iOS10 ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0)NSString * urlString = @"App-Prefs:root=WIFI";if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlString]]) {    if (iOS10) {        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];    } else {        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];    }}

第二种方式:
用到了私有API,慎用,若想使用并通过审核,可以对私有方法名等加密

NSURL*url=[NSURL URLWithString:@"Prefs:root=WIFI"];    Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");    [[LSApplicationWorkspace performSelector:@selector(defaultWorkspace)] performSelector:@selector(openSensitiveURL:withOptions:) withObject:url withObject:nil];

附录:iOS10之后,其它界面的跳转

当前iOS10支持的所有跳转,亲测可用(测试系统:10.2.1)跳转  写法无线局域网   App-Prefs:root=WIFI蓝牙  App-Prefs:root=Bluetooth蜂窝移动网络  App-Prefs:root=MOBILE_DATA_SETTINGS_ID个人热点    App-Prefs:root=INTERNET_TETHERING运营商 App-Prefs:root=Carrier通知  App-Prefs:root=NOTIFICATIONS_ID通用  App-Prefs:root=General通用-关于本机 App-Prefs:root=General&path=About通用-键盘   App-Prefs:root=General&path=Keyboard通用-辅助功能 App-Prefs:root=General&path=ACCESSIBILITY通用-语言与地区    App-Prefs:root=General&path=INTERNATIONAL通用-还原   App-Prefs:root=Reset墙纸  App-Prefs:root=WallpaperSiri    App-Prefs:root=SIRI隐私  App-Prefs:root=PrivacySafari  App-Prefs:root=SAFARI音乐  App-Prefs:root=MUSIC音乐-均衡器  App-Prefs:root=MUSIC&path=com.apple.Music:EQ照片与相机   App-Prefs:root=PhotosFaceTime    App-Prefs:root=FACETIME
0 0
原创粉丝点击