I need to get the name of the currently connected Wi-Fi hotspot, e.g. "BT OpenZone"
I have been told it can be done with CaptiveNetwork specifically CNCopyCurrentNetworkInfo
My code so far:
#import <SystemConfiguration/CaptiveNetwork.h>
...
// Get the dictionary containing the captive network infomation
CFDictionaryRef captiveNtwrkDict = CNCopyCurrentNetworkInfo(kCNNetworkInfoKeySSID);
// Get the count of the key value pairs to test if it has worked
int count = CFDictionaryGetCount(captiveNtwrkDict);
NSLog(@"Count of dict:%d",count);
When the code runs on a device in a WiFi hotspot the captiveNtwrkDict
is nil.
Has anyone managed to get it working? I cant find much documentation or any example code examples on CaptiveNetworks... any help would be much appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…