I am using CNCopySupportedInterfaces to get the connected wifi network, but it shows nil sometime.
I have enabled all the capabilities like Wifi Information, Hotspot configuration & network extension. I have also allowed the location permission too. I am using ios 13.2
I used the NEHotspotConfiguration too but it is also returning the nil & this is the random issue.
Below is the code to get the wifi info:
-(NSString*)fetchSSIDInfo {
NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
NSDictionary *info;
for (NSString *ifnam in ifs) {
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info && [info count]) {
return [info objectForKey:@"SSID"];
break;
}
}
return @"No WiFi Available";
}
Is this the iOS issue or any other solution for this.