Bluetooth On/Off 와 비슷하나 dylib 에서 가능하다고 함.
1. On app
notify_post("com.yourcompany.yourapp.yournotification");
2. On 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];
}
관련링크: http://stackoverflow.com/questions/2053114/iphone-wi-fi-manager-sdk
'Mobile > iOS' 카테고리의 다른 글
Bluetooth On/Off (0) | 2012.07.25 |
---|---|
Launch image 효과 (0) | 2012.07.24 |
상태바 스타일 변경 (0) | 2012.07.24 |
HTTP 파일 이어받기 (0) | 2012.07.11 |
Rounded corners on a view (0) | 2012.07.02 |