How to get battery level with 1

后端 未结 5 1505
陌清茗
陌清茗 2020-12-17 17:17

How to get battery level with 1 % accuracy .

       [UIDevice currentDevice].batteryLevel

Will give battery level with accuracy of 5%. But

5条回答
  •  忘掉有多难
    2020-12-17 17:53

    If you're jailbroken, you can simply use

    int percent = [(SBUIController*)[objc_getClass("SBUIController") sharedInstance] displayBatteryCapacityAsPercentage];
    

    This method is present on iOS 4.3+, and is probably what Battery Doctor is using.

提交回复
热议问题