jjzjj

UIDeviceBatteryState

全部标签

iphone - 如何知道 iOS 设备是通过 USB 还是 Wall Port Charger 连接的?

我很想知道iOS中是否有任何可能性,通过它我们可以知道设备是通过USB电缆还是Wallport连接的。换句话说,我希望我的应用程序显示设备是通过USB数据线还是墙上端口充电。 最佳答案 来自UIDevice类引用UIDeviceBatteryStateDidChangeNotificationPostedwhenbatterystatechanges.Forthisnotificationtobesent,youmustsetthebatteryMonitoringEnabledpropertytoYES.Youcanobtaint