Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Wi-Fi Manager SDK

I'm attempting several methods trying to enable/disable Wi-Fi (toggle). Here are some things I am trying:

//Enable
WiFiManagerClientEnable(WiFiManagerClientCreate(kCFAllocatorDefault, 0));
//Disable
WiFiManagerClientDisable(WiFiManagerClientCreate(kCFAllocatorDefault, 0));

-and-

//Enable
WiFiManagerClientSetProperty(WiFiManagerClientCreate(kCFAllocatorDefault, 0), @"AllowEnable", kCFBooleanTrue);
//Disable
WiFiManagerClientSetProperty(WiFiManagerClientCreate(kCFAllocatorDefault, 0), @"AllowEnable", kCFBooleanFalse);

Each of those end up crashing the app, even though I have an exception function (@try{}). I've imported the MobileWiFi.framework and everything, just cant seem to get this to work. Are these the correct methods I need to call to be able to enable/disable Wi-Fi?

NOTE: NOT FOR APP STORE :-)

like image 278
WrightsCS Avatar asked Jan 12 '10 22:01

WrightsCS


People also ask

Is there an iPhone app that I can connect to my router and see the activity of devices connected to my Wi-Fi?

Fing is the #1 Network Scanner: discovers all the devices connected to your WiFi and identifies them, with our patented technology used also by router manufacturers and antivirus companies worldwide.

Can you do Wi-Fi direct with iPhone?

Select Wi-Fi in the iPhone's settings to turn on the Wi-Fi. Tap Direct-xx-BRAVIABRAVIABravia (stylized as BRAVIA) is a brand of Sony Visual Products Inc., a wholly owned subsidiary of Sony Corporation, and used for its television products. Its backronym is "Best Resolution Audio Visual Integrated Architecture".https://en.wikipedia.org › wiki › Bravia_(brand)Bravia (brand) - Wikipedia on the iPhone's screen to display the password input screen. Enter the WPA key (password) displayed on the TV screen, then tap Join. Allow a few minutes for the connection to be established, and the Settings screen to appear.


1 Answers

From Application

notify_post("com.yourcompany.yourapp.yournotification");

From Dylib

#import <SpringBoard/SBWiFiManager.h>

HOOK(SpringBoard, applicationDidFinishLaunching$, void, id app) {
    //Listen for events via DARWIN NOTIFICATION CENTER
    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL,
     &NotificationReceivedCallback, CFSTR("com.yourcompany.yourapp.yournotification"), NULL, 
      CFNotificationSuspensionBehaviorCoalesce);
}

//THIS IS WHERE THE MAGIC HAPPENS
static void NotificationReceivedCallback(CFNotificationCenterRef center, 
                                            void *observer, CFStringRef name, 
                                            const void *object, CFDictionaryRef 
                                            userInfo) 
{ 
    [[objc_getClass("SBWiFiManager") sharedInstance] setWiFiEnabled:NO];
}
like image 104
WrightsCS Avatar answered Oct 07 '22 00:10

WrightsCS