How to get the SSID name from your iPhone Application using Xcode 6x iOS8x

Sometimes you might need to fetch the SSID of the Wireless Router that your iPhone Application connects to. The following code, will help you get the SSIS name.

Firstly you will have to add the CaptiveNetwork framework into your project, and then import it in your .h file. Like this;

#import <SystemConfiguration/CaptiveNetwork.h>

In your implementation file .m, add this piece of code to get the SSID name.

NSString *ssid = @””;

NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();

for (NSString *ifnam in ifs) {

NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

if (info[@”SSID”]) {

ssid = info[@”SSID”];

}

}

if(![ssid  isEqual: @”SOMEWIRELESSNAME”])

{ // DO SOMETHING HERE

}

Good Luck!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s