Nicolò Ciraci
Nicolò Ciraci

Reputation: 678

Obtaining wifi name in iOS

I'm developing an app for Cydia. Is there a way to get the name of actual connected wifi network?

There seems to be a way with the Apple SDK, any ideas?

This is my action:

-(IBAction)addCurrent:(id)sender {
if ([[objc_getClass("SBWiFiManager") sharedInstance] currentNetworkName] != @"") {
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:pathFile];
        NSMutableArray *networks = [dict objectForKey:@"Networks"];
        [networks addObject:[[objc_getClass("SBWiFiManager") sharedInstance] currentNetworkName]];
        [dict setObject:networks forKey:@"Networks"];
        [dict writeToFile:pathFile atomically: YES];
        [dict release];
}

When I click the button connected to the action, does not add anything to the plist file

Upvotes: 0

Views: 1723

Answers (2)

Krivoblotsky
Krivoblotsky

Reputation: 1502

You can use my 3rd party library for this, it uses only Public API: https://github.com/Krivoblotsky/SSIDObserver

Upvotes: 0

WrightsCS
WrightsCS

Reputation: 50727

This will require a jailbroken device:

[[objc_getClass("SBWiFiManager") sharedInstance] currentNetworkName]

Upvotes: 1

Related Questions