From UIDevice Class Reference
UIDeviceBatteryStateDidChangeNotification Posted when battery state changes. For this notification to be sent, you must set the batteryMonitoringEnabled property to YES. You can obtain the battery state by getting the value of the batteryState property.
When you receive a notification, you need to check
UIDeviceBatteryState == UIDeviceBatteryStateUnplugged
Listing
UIDeviceBatteryState The battery power state of the device. typedef enum { UIDeviceBatteryStateUnknown, UIDeviceBatteryStateUnplugged, UIDeviceBatteryStateCharging, UIDeviceBatteryStateFull, } UIDeviceBatteryState;
source share