Skip to content

Instantly share code, notes, and snippets.

@nakiwo
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakiwo/e5e28124afbe4d32b490 to your computer and use it in GitHub Desktop.
Save nakiwo/e5e28124afbe4d32b490 to your computer and use it in GitHub Desktop.
SSID取得
@import SystemConfiguration;
#import <SystemConfiguration/CaptiveNetwork.h>
- (NSString *)currentSSID
{
NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces());
if (!interfaceNames.count) {
return nil;
}
NSString *interfaceName = interfaceNames.firstObject;
if (!interfaceName) {
return nil;
}
NSDictionary *info = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName));
NSString *ssid = info[(__bridge NSString *)kCNNetworkInfoKeySSID];
return ssid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment