[UIDevice currentDevice].batteryMonitoringEnabled = YES;
double deviceLevel = [UIDevice currentDevice].batteryLevel;

 获取当前剩余电量, 我们通常采用上述方法。这也是苹果官方文档提供的。

它返回的是0.00-1.00之间的浮点值。 另外, -1.00表示模拟器。

 

 

相关文章:

  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-06-24
  • 2021-07-31
  • 2022-01-22
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-06-04
  • 2021-11-26
相关资源
相似解决方案