开发者

How Can I Access the WiFiManager Framework iOS?

I am trying to access the WiFiManager Framework (previously apple80211) and can't find the right information. I understand Apple doesn't allow the use of private frameworks for apps on the app store but I am writing this app for personal use so this is of no concern to me. What I need to know is can I still access the WiFi开发者_运维知识库Manager Framework for an app I upload directly to my phone and is there any information out there on how to? Thanks in advance for ANY help.


See my answer here.

//IN YOUR APP
notify_post("com.yourcompany.yourapp.yournotification");

//IN YOUR 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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜