I am trying to display battery percentage with UILabel , but the result is nonsense ! here is my code :
UIDevice *myDevice = [UIDevice currentDevice];
[myDevice setBatteryMonitoringEnabled:YES];
int i=[myDevice batteryState];
_battery.text = [NSString stringWithFormat:@"%i",i];
the labels shows number 2 !!!!