2
在访问电池信息之前,我将BatteryMonitoringEnabled
设置为True。MonoTouch电池电量始终为-1
该文档指出,只有在监视未启用时才应返回-1。
但是,我总是得到-1作为BatteryLevel
属性的值,未知值为BatteryState
,尽管我启用了监视。
UIDevice.CurrentDevice.BatteryMonitoringEnabled=true;
Console.WriteLine (UIDevice.CurrentDevice.BatteryLevel.ToString());
结果-1
Console.WriteLine (UIDevice.CurrentDevice.BatteryState.ToString());
结果 “未知”
任何事情,我在这里失踪?
是的,我正在模拟器中尝试这个。我的印象是它应该像普通设备一样工作。现在我知道它不应该:)是否有任何在模拟器上不起作用的列表? – SharpAffair 2012-04-22 15:33:38
请记住它是*模拟器*不是*模拟器* - 有利有弊:-) – poupou 2012-04-22 15:35:39