OGeek|极客世界-中国程序员成长平台

标题: ios - 终端的电池电量 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:28
标题: ios - 终端的电池电量

有没有办法在 iOS 设备插入计算机时从终端获取电池电量?我查看了 ioreg 并且只显示我的 macbook 的电池。



Best Answer-推荐答案


我能够在 macOS 10.14.2 中使用 Homebrew 的 libimobiledevice 公式获取此信息。您可能需要使用最新版本的库,因此 --HEAD 附加到安装命令:

$ brew install --HEAD libimobiledevice

之后,尝试以下命令:

$ idevice_id --list
<UDID>

$ ideviceinfo -u <UDID> --simple
DeviceName: foo's phone
HardwareModel: D22AP
ProductName: iPhone OS
ProductType: iPhone10,3
ProductVersion: 12.0

$ ideviceinfo -u <UDID> --domain com.apple.mobile.battery
BatteryCurrentCapacity: 43
BatteryIsCharging: true
ExternalChargeCapable: true
ExternalConnected: true
FullyCharged: false
GasGaugeCapability: true
HasBattery: true

提供更多信息。尝试 ideviceinfo --help 列出您可以查询的其他域。

关于ios - 终端的电池电量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35297388/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4