xcode iPhone电池耗尽问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14151152/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:27:45  来源:igfitidea点击:

iPhone battery drain issue

iphoneiosxcodebatterybatterylevel

提问by Paul T.

I think my question will be useful for others. I have battery drain issue and want to find out where it is.

我认为我的问题对其他人有用。我有电池耗尽问题,想知道它在哪里。

I use xcode instruments: Enter profile enter image description herethen Energy Diagnostics, but I see nothing in energy usage section. enter image description here

我使用 xcode 工具:输入配置文件,在此处输入图片说明然后输入 能源诊断,但我在能源使用部分看不到任何内容。 在此处输入图片说明

How can I enable information in Energy Usage section?

如何在能源使用部分启用信息?

采纳答案by Stavash

Energy profiling is a bit more tricky. You need to:

能量分析有点棘手。你需要:

  1. Enable energy logging via the device's developer settings
  2. Disconnect device from ANY power source (this of course means that you can't see the stats live in instruments)
  3. Start logging via the device developer settings
  4. Perform the actions you wish to profile
  5. Stop logging via the device developer settings
  6. Connect device to Mac, open instruments and select File->Import logged data from device
  1. 通过设备的开发者设置启用能量记录
  2. 断开设备与任何电源的连接(这当然意味着您无法看到仪器中的实时统计数据)
  3. 通过设备开发者设置开始记录
  4. 执行您希望配置文件的操作
  5. 通过设备开发者设置停止记录
  6. 将设备连接到 Mac,打开仪器并选择文件->从设备导入记录的数据

Now you'll see the energy usage statistics.

现在您将看到能源使用统计数据。

回答by nst

You can also try to log the power consumption programatically.

您还可以尝试以编程方式记录功耗。

Several ways of doing this can be found in the BatteryChart project: https://github.com/nst/BatteryChart

可以在 BatteryChart 项目中找到执行此操作的几种方法:https: //github.com/nst/BatteryChart