iOS-Runtime-Headers icon indicating copy to clipboard operation
iOS-Runtime-Headers copied to clipboard

which private framework to use to get the battery usage?

Open viewrain opened this issue 10 years ago • 1 comments

Hi, all: We used /System/Library/PrivateFrameworks/PowerlogLoggerSupport.framework to get the battery usage on iOS 6/7, but now it's gone in iOS 8 private frameworks. Do you know if there's any alternative? Or do you know any other groups we could ask this question?

Thanks.

viewrain avatar Oct 20 '14 21:10 viewrain

Hi.

It seems that BatteryCenter.framework under PrivateFrameworks seems to be your framework in search.

I'm trying to access it with the following code:

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"]);
}

Although I'm getting NULL. I would really like to see if you can get it to work.

Thanks. Good luck. :)

cansurmeli avatar Oct 27 '15 14:10 cansurmeli