iPhone Wi-Fi 管理器 SDK [英] iPhone Wi-Fi Manager SDK
本文介绍了iPhone Wi-Fi 管理器 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?
注意:不适用于应用商店 :-)
推荐答案
From Application
notify_post("com.yourcompany.yourapp.yournotification");
来自 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 管理器 SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文