[英]NEHotspotConfiguration is not working in ios 11
I tried to connect the specific wifi with ssid and password using NEHotspotConfiguration, it has the internal server error.我尝试使用 NEHotspotConfiguration 用 ssid 和密码连接特定的 wifi,它有内部服务器错误。
Please help me if you have the answer for how to connect to a wifi AP on ios.如果您有关于如何在 ios 上连接到 wifi AP 的答案,请帮助我。
Try the following:请尝试以下操作:
Here is my code, it may work for you:这是我的代码,它可能对你有用:
-(IBAction) joinWiFi_ButtonPressed: (id) sender {
if (@available (iOS 11.0, *)) {
NEHotspotConfiguration * configuration = [[NEHotspotConfiguration alloc] initWithSSID: @ "Your SSID" passphrase: @ "Password" isWEP: NO];
configation.joinOnce = YES;
[[NEHotspotConfigurationManager sharedManager] applyConfiguration: configuration completionHandler: ^ (NSError * _Nullable error) {
if (error == nil) {
NSLog (@ "Is Connected!!");
} else {
NSLog (@ "Error is:% @", error);
}}];
} else {
NSLog (@ "This Device Not iOS 11 +");
}
}
Can you post your error log?你能贴出你的错误日志吗? It could help me to better understand your question and refine my answer.
它可以帮助我更好地理解您的问题并完善我的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.