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