【发布时间】:2023-03-09 00:20:02
【问题描述】:
我正在尝试在nst's iOS Runtime Headers 的帮助下在iOS 9.1 下使用BatteryCenter 和CommonUtilities 私有框架。它用于研究目的,不会上架 AppStore。
这是他们各自的代码:
- (void)batteryCenter {
NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/BatteryCenter.framework"];
BOOL success = [bundle load];
if(success) {
Class BCBatteryDevice = NSClassFromString(@"BCBatteryDevice");
id si = [[BCBatteryDevice alloc] init];
NSLog(@"Charging: %@", [si valueForKey:@"charging"]);
}
}
- (void)commonUtilities {
NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/CommonUtilities.framework"];
BOOL success = [bundle load];
if(success) {
Class CommonUtilities = NSClassFromString(@"CUTWiFiManager");
id si = [CommonUtilities valueForKey:@"sharedInstance"];
NSLog(@"Is Wi-Fi Enabled: %@", [si valueForKey:@"isWiFiEnabled"]);
NSLog(@"Wi-Fi Scaled RSSI: %@", [si valueForKey:@"wiFiScaledRSSI"]);
NSLog(@"Wi-Fi Scaled RSSI: %@", [si valueForKey:@"lastWiFiPowerInfo"]);
}
}
虽然我找回了类,但它们所有受尊重的值都是 NULL,这很奇怪,因为有些必须是真的,例如我已连接到 Wi-Fi,所以 isWiFiEnabled 应该是 YES。
我的代码没有返回预期的结果究竟缺少什么?它需要权利吗?如果有,具体是什么?
【问题讨论】:
标签: ios iphone-privateapi