objective-ccydia

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


Solution

  • This will require a jailbroken device:

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