Thyraz Thyraz - 1 year ago 145
iOS Question

How to get Wifi SSID in iOS9 after CaptiveNetwork is depracted and calls for Wifi name are already blocked

Until today I used the CaptiveNetwork Interface to display the name of the currently connected Wifi.
The iOS 9 Prerelease reference already stated, that the CaptiveNetwork methods are depracted now, but they still worked at the beginning.

With the newest version Apple seems to have blocked this calls already (maybe due to privacy concerns?).

Is there any other way to get the name of the current Wifi?

This is how I obtained the SSID until today, but you only get nil now:

#import <SystemConfiguration/CaptiveNetwork.h>

NSString *wifiName = nil;
NSArray *interFaceNames = (__bridge_transfer id)CNCopySupportedInterfaces();

for (NSString *name in interFaceNames) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)name);

if (info[@"SSID"]) {
wifiName = info[@"SSID"];

Answer Source

In the GM for iOS 9, it seems like this is enabled again. In fact, it's not even listed as deprecated in the online documentation, however the CaptiveNetwork header file does have the following:


So, it is working in the iOS 9 GM, but not sure for how long :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download