【发布时间】:2012-04-22 14:21:07
【问题描述】:
在访问电池信息之前,我将 BatteryMonitoringEnabled 设置为 True。
文档说只有在没有启用监控的情况下才应该返回-1。
但是,尽管我启用了监控,但我总是得到 -1 作为 BatteryLevel 属性的值和 Unknown 作为 BatteryState。
UIDevice.CurrentDevice.BatteryMonitoringEnabled=true;
Console.WriteLine (UIDevice.CurrentDevice.BatteryLevel.ToString());
结果-1
Console.WriteLine (UIDevice.CurrentDevice.BatteryState.ToString());
结果“未知”
我在这里遗漏了什么?
【问题讨论】:
标签: c# ios xamarin.ios power-management uidevice