我想知道如何拥有Mha for iPhone / iPad电池的数据容量。 我会将它们放在我打算放在appstore上的应用程序中,然后我就不能使用IOKit了。 有谁知道我如何获得这些价值观?
答案 0 :(得分: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的实际值。