首页 > 系统 > iOS > 正文

iOS10 跳转系统wifi列表

2019-11-09 18:48:23
字体:
来源:转载
供稿:网友

iOS10 之后不允许跳转到任何系统设置页面,但是可以通过私有API跳转到系统设置页面,私有方法如下(慎用):

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

可利用ASCII值进行拼装组合或者对私有方法名加密来绕过审核,ASCII值进行拼装组合的方法如下:

-(NSString *) getDefaultWork{ NSData *dataOne = [NSData dataWithBytes:(unsigned char []){0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x57,0x6f,0x72,0x6b,0x73,0x70,0x61,0x63,0x65} length:16]; NSString *method = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding]; return method;}-(NSString *) getWifiMethod{ NSData *dataOne = [NSData dataWithBytes:(unsigned char []){0x6f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x6e, 0x73, 0x69,0x74, 0x69,0x76,0x65,0x55,0x52,0x4c} length:16]; NSString *keyone = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding]; NSData *dataTwo = [NSData dataWithBytes:(unsigned char []){0x77,0x69,0x74,0x68,0x4f,0x70,0x74,0x69,0x6f,0x6e,0x73} length:11]; NSString *keytwo = [[NSString alloc] initWithData:dataTwo encoding:NSASCIIStringEncoding]; NSString *method = [NSString stringWithFormat:@"%@%@%@%@",keyone,@":",keytwo,@":"]; return method;}NSString * defaultWork = [self getDefaultWork];NSString * wifiMethod = [self getWifiMethod]; NSURL*url=[NSURL URLWithString:@"Prefs:root=WIFI"];Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");[[LSApplicationWorkspace performSelector:NSSelectorFromString(defaultWork)] performSelector:NSSelectorFromString(wifiMethod) withObject:url withObject:nil];

注意:苹果的私有方法一旦修改,我们必须重新进行修改

参考资料: 关于iOS 10,跳转系统设置问题 聊聊iOS 10更新以后跳转系统设置的几种方式


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表