On the iPhone, is it possible to find out which WIFI network we are connected to?

11,190

Solution 1

(Separate answer to preserve history etc.)

It looks like you might not be able to determine the SSID of the WLAN to which you're connected, at least in an app that will go into the App Store. These people use a private API - Preferences.framework - to get to the details of the WLAN (like "is it hidden?" "What's the name?" etc.).

Solution 2

Try following method:

#import <SystemConfiguration/CaptiveNetwork.h>

NSString *wifiName = @"Not Found";
CFArrayRef myArray = CNCopySupportedInterfaces();

if (myArray != nil) {

    CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));

    if (myDict != nil) {
        NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict);

        wifiName = [dict valueForKey:@"SSID"];

    }  
}

NSLog(@"wifiName:%@", wifiName);

Solution 3

Can't comment, but this might be a duplicate:

Accessing iPhone WiFi Information via SDK

Answer seems to be no. I've done my own research on this and have been unable to find a supported way of getting the SSID.

Share:
11,190
Plumenator
Author by

Plumenator

I'm a programmer working in Singapore, currently in Scala, formerly in Rust, C++, Haskell.

Updated on June 16, 2022

Comments