iPhone Wi-Fi Manager SDK [英] iPhone Wi-Fi Manager SDK
本文介绍了iPhone Wi-Fi Manager SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用多种方法来启用/禁用Wi-Fi(切换)。以下是我正在尝试的一些事情:
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));
- 和 -
//Enable
WiFiManagerClientSetProperty(WiFiManagerClientCreate(kCFAllocatorDefault, 0), @"AllowEnable", kCFBooleanTrue);
//Disable
WiFiManagerClientSetProperty(WiFiManagerClientCreate(kCFAllocatorDefault, 0), @"AllowEnable", kCFBooleanFalse);
即使我有异常功能,每个人最终都会崩溃应用程序(@try {} )。
我已经导入了MobileWiFi.framework和所有东西,但似乎无法让它工作。这些是我需要调用才能启用/禁用Wi-Fi的正确方法吗?
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?
注意:不适用于APP STORE: - )
推荐答案
从应用程序
From Application
notify_post("com.yourcompany.yourapp.yournotification");
来自Dylib
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];
}
这篇关于iPhone Wi-Fi Manager SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文