Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试确定他的设备是否已插入并正在充电。如何在 ios 5.x 或更高版本中查找?
你可以UIDevice用来获取这些信息
UIDevice
使用以下
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateCharging) NSLog(@"device is conected to power");