Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

If yes, can we also get additional information about the network configuration?

One useful way to do this could be getting the SSID of the current network. Is there an API to do that?

Update: I found a similar question here:

Can the iPhone SDK obtain the Wi-Fi SSID currently connected to?

like image 206
Plumenator Avatar asked Apr 14 '10 11:04

Plumenator


People also ask

How do I see all the Wi-Fi networks on my iPhone?

Open the Keychain Access app desribed above. On the left, in the Keychains box, click "iCloud". In the main display, click on "Kind" to sort all entries by kind. All the wifi networks will now be listed together with the kind "AirPort network password".

How can I see what all Wi-Fi networks I have connected to in the past?

Start by going to Settings > Network & Internet > Wi-Fi, where you can find and click the Manage Known Networks link to see your list of saved wireless networks.

How do I identify a WiFi network?

On an Android phone this is achieved by swiping down from the top of the screen to open the Notifications pane. You'll see a Wi-Fi icon which you'll need to tap and hold. This will then open the Wi-Fi section. iPhone and iPad users can go to Settings > Wi-Fi.


2 Answers

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);
like image 73
Paradise Avatar answered Sep 28 '22 08:09

Paradise


(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.).

like image 33
Frank Shearar Avatar answered Sep 28 '22 06:09

Frank Shearar