Skip to content

Instantly share code, notes, and snippets.

@tonycn
Last active December 18, 2015 07:16
Show Gist options
  • Save tonycn/f877044ebdf80599cb26 to your computer and use it in GitHub Desktop.
Save tonycn/f877044ebdf80599cb26 to your computer and use it in GitHub Desktop.
iOS SSID
NSString *currentSSID = @"";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil){
NSDictionary* myDict = (__bridge NSDictionary *) CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict!=nil){
currentSSID=[myDict valueForKey:@"SSID"];
} else {
currentSSID=@"<<NONE>>";
}
} else {
currentSSID=@"<<NONE>>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment