iPhone剩余电池未刷新
在阅读了很多其他的问题和答案,并尝试了不同的解决方案后,我仍然有一个问题是如何获得贝特里水平。 第一次呼叫我得到了正确的值,但接下来的呼叫我得到了与第一次呼叫相同的电池值。我错过了什么iPhone剩余电池未刷新,iphone,battery,Iphone,Battery,在阅读了很多其他的问题和答案,并尝试了不同的解决方案后,我仍然有一个问题是如何获得贝特里水平。 第一次呼叫我得到了正确的值,但接下来的呼叫我得到了与第一次呼叫相同的电池值。我错过了什么 [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; UIDevice *myDevice = [UIDevice currentDevice]; [myDevice setBatteryMonitoringEnabled:YES]; dou
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
UIDevice *myDevice = [UIDevice currentDevice];
[myDevice setBatteryMonitoringEnabled:YES];
double batLeft = (float)[myDevice batteryLevel] * 100;