iPhone get SSID without private library

后端 未结 9 792
[愿得一人]
[愿得一人] 2020-11-22 06:00

I have a commercial app that has a completely legitimate reason to see the SSID of the network it is connected to: If it is connected to a Adhoc network for a 3rd party har

9条回答
  •  无人及你
    2020-11-22 06:36

    Here's the cleaned up ARC version, based on @elsurudo's code:

    - (id)fetchSSIDInfo {
         NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
         NSLog(@"Supported interfaces: %@", ifs);
         NSDictionary *info;
         for (NSString *ifnam in ifs) {
             info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
             NSLog(@"%@ => %@", ifnam, info);
             if (info && [info count]) { break; }
         }
         return info;
    }
    

提交回复
热议问题