Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone剩余电池未刷新_Iphone_Battery - Fatal编程技术网

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;