【发布时间】:2012-07-02 13:19:30
【问题描述】:
我正在尝试确定他的设备是否已插入并正在充电。如何在 ios 5.x 或更高版本中找到?
【问题讨论】:
标签: ios apple-push-notifications power-management
我正在尝试确定他的设备是否已插入并正在充电。如何在 ios 5.x 或更高版本中找到?
【问题讨论】:
标签: ios apple-push-notifications power-management
您可以使用UIDevice 获取这些信息
使用下面的
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateCharging)
NSLog(@"device is conected to power");
【讨论】: