Post

Replies

Boosts

Views

Activity

CNCopySupportedInterfaces takes around 30-40s to return current connected ssid.
In our iOS application there are many places where we need to fetch current connected ssid and we are fetching it from CNCopySupportedInterfaces.We are observing an issue where CNCopySupportedInterfaces is taking 30 to 40 seconds to fetch ssid name which is therefore blocking the main thread and leading to make our application crash. We did not find any issues calling this api CNCopySupportedInterfaces on main thread specified in any of the apple documents. Please note we are experiencing this issue only in a particular network environment. Code snippet : (NSString *)getwifiName{ NSString *wifiStr = nil; CFArrayRef arrayRef = CNCopySupportedInterfaces(); NSArray *interfaces = (_bridge NSArray *)arrayRef; if (interfaces) { for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((CFStringRef)interfaceName); if (dictRef != NULL) { NSDictionary *networkInfo = (bridge NSDictionary *)dictRef; wifiStr = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:@"SSID"]]; CFRelease(dictRef); } } CFRelease(arrayRef); } if(wifiStr == nil) { wifiStr = [NSString stringWithFormat:NSLocalizedString(@"MobileDeviceWIFINotEnable",nil)]; } NSLog(@"Connected WifiStr - %@",wifiStr); return wifiStr; }
5
0
1.4k
Sep ’21