2012-01-30 80 views
0

我想知道如何獲得Mha for iPhone/iPad電池的數據容量。 我會把它們放在我打算放在appstore上的應用程序中,然後我不能使用IOKit。 有誰知道我怎麼能得到這些值?iPhone的電池容量值以mAH爲單位

+1

你的意思是毫安時(毫安) – 2012-01-30 09:54:46

+0

是的:)......毫安 – AleMal 2012-01-30 09:58:16

回答

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 

UIDevice Class Reference

的,那麼你可以添加到您的應用程序的plist中,你會把所有的電池容量爲每一個設備,讀取設備模型和電池的percentange和滿負荷,你可以得到以mAH爲單位的實際值。