我想知道 iPhone/iPad 电池的 Mha 数据容量。我会把它们放在我打算放在 appstore 上的应用程序中,然后我就不能使用 IOKit。有谁知道我怎样才能得到这些值?
问问题
986 次
1 回答
2
batteryLevel
The battery charge level for the device.
@property (nonatomic, readonly) float batteryLevel
Discussion
Battery level ranges from 0.0 (fully discharged) to 1.0 (100% charged). Before accessing this property, ensure that battery monitoring is enabled.
If battery monitoring is not enabled, battery state is UIDeviceBatteryStateUnknown and the value of this property is –1.0.
Availability
Available in iOS 3.0 and later.
See Also
@property batteryState
@property batteryMonitoringEnabled
Declared In
UIDevice.h
然后,您可以向您的应用程序添加一个 plist,您将在其中放置每台设备的所有电池容量,读取设备型号,并根据电池和满容量的百分比,您可以获得以 mAH 为单位的实际值。
于 2012-01-30T10:02:22.560 回答