iOS自动连接指定Wi-Fi
Target-->Capabilities-->Hostpot configuration 打开
连接指定Wi-Fi
NEHotspotConfiguration* configuration = [[NEHotspotConfiguration alloc]initWithSSID:@"WI-FI Name" passphrase:@"PassWord" isWEP:NO];
[[NEHotspotConfigurationManager sharedManager] applyConfiguration:configuration completionHandler:^(NSError * _Nullable error) {
NSLog(@"error:%@", error);
}];
我猜测是搜索附近连接过的Wi-Fi
[[NEHotspotConfigurationManager sharedManager] getConfiguredSSIDsWithCompletionHandler:^(NSArray * array) {
for(NSString* str in array) {
NSLog(@"结果:%@",str);
}
}];
网友评论