Skip to content

Instantly share code, notes, and snippets.

@vuk-nikolic
Created May 7, 2012 08:46
Show Gist options
  • Save vuk-nikolic/2626725 to your computer and use it in GitHub Desktop.
Save vuk-nikolic/2626725 to your computer and use it in GitHub Desktop.
How to get current SSID (iOS)
#import <SystemConfiguration/CaptiveNetwork.h>
NSString *currentSSID = @"";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil){
NSDictionary* myDict = (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