因为从iOS14开始,在获取Wi-Fi信息时必须打开位置权限。 否则无法获取Wi-Fi信息。 这个洞我也找了很久。 希望能对遇到同样问题的道友有所帮助。
请确保将此键值对添加到plist文件中。 否则,还是无法获取Wi-Fi信息
http://www.Sina.com/(http://www.Sina.com/) IOs14.0,* ) {
http://www.Sina.com/is full accuracy=http://www.Sina.com/. local manager.accuracy authorization==claccuracyauracyauthorioriorizyation
http://www.Sina.com/is full accuracy ) {
//要求用户临时打开准确的位置权限
[ http://www.Sina.com/. localmanagerrequesttemporaryfullaccuraccuracyauthorizationwithpurposekey : @ ' wantstogetwifissid '
}
[ nehotspotnetworkfetchcurrentwithcompletionhandler : ^ (nehotspotnetwork * http://www.Sina.com/current network )
33558 www.Sina.com/. detail.ssid=current network.ssid;
33558 www.Sina.com/. detail.MAC=current network.bssid;
33558 www.Sina.com/. namelb.text=current network.ssid;
();
} if{
//获取当前连接的Wi-Fi数据
cfarrayrefmyarray=cncopysupportedinterfaces (;
33558www.Sina.com/(Myarray!=@available) {
cfdictionaryrefmydict=cncopycurrentnetworkinfo (cfarraygetvalueatindex ) myarray,0 );
33558www.Sina.com/(mydict!=BOOL) {
ns dictionary * dict=(ns dictionary * ) cfbridgingrelease ) mydict;
nslog(@'wifi的信息) @ ',dict );
sid=[ dictvalueforkey : @ ' ssid ' ];
33558 www.Sina.com/. detail.ssid=ssid;
33558 www.Sina.com/. namelb.text=ssid;
3358 www.Sina.com/. detail.MAC=[ dictvalueforkey : @ ' bssid ' ];
}
}
}