読者です 読者をやめる 読者になる 読者になる

充電器に刺さっているかをチェックする

UIDevice* device = [UIDevice currentDevice];
device.batteryMonitoringEnabled = YES;
UIDeviceBatteryState deviceBatteryState = [UIDevice currentDevice].batteryState;
NSLog(@"%ld",deviceBatteryState);

UIDeviceBatteryState

typedef enum {
UIDeviceBatteryStateUnknown ,
UIDeviceBatteryStateUnplugged ,
UIDeviceBatteryStateCharging ,
UIDeviceBatteryStateFull ,
} UIDeviceBatteryState;