IOS to obtain the connected wifi information implementation code
First, you need #import <SystemConfiguration/>
+ (id)fetchSSIDInfo { NSArray *ifs = (id)CNCopySupportedInterfaces(); NSLog(@"%s: Supported interfaces: %@", __func__, ifs); id info = nil; for (NSString *ifnam in ifs) { info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam); NSLog(@"%@ => %@", ifnam, info); if (info && [info count]) { break; } [info release]; } [ifs release]; return [info autorelease]; }
ARC version:
+ (id)fetchSSIDInfo { NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); NSLog(@"%s: Supported interfaces: %@", __func__, ifs); id info = nil; for (NSString *ifnam in ifs) { info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); NSLog(@"%@ => %@", ifnam, info); if (info && [info count]) { break; } } return info; }
The above is an example of IOS obtaining connected wifi information. If you have any questions, please leave a message or go to the community of this site to communicate and discuss. Thank you for reading. I hope it can help you. Thank you for your support for this site!