1

I can get the wifi name from a real device, but in the simulator it is not giving any value. Is it possible to get the wifi name in the simulator? Is there any options to get the default wifi name like location services?

Below is my code to get the wifi name on the real device

- (NSDictionary *)fetchSSIDInfo
{
    NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces());
    NSLog(@"%s: Supported interfaces: %@", __func__, interfaceNames);

    NSDictionary *SSIDInfo;
    for (NSString *interfaceName in interfaceNames) {
        SSIDInfo = CFBridgingRelease(
                                     CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName));
        NSLog(@"%s: %@ => %@", __func__, interfaceName, SSIDInfo);

        BOOL isNotEmpty = (SSIDInfo.count > 0);
        if (isNotEmpty) {
            break;
        }
    }
    return SSIDInfo;
}
Johnykutty
  • 12,091
  • 13
  • 59
  • 100
Test iOS
  • 175
  • 2
  • 13

0 Answers0