iOS device is locked/unlocked (判断手机屏幕是否锁屏)
#import <notify.h> -(void)checkDeviceLockScreenState { int notify_token; notify_register_dispatch("com.apple.springboard.lockstate", ¬ify_token,dispatch_get_main_queue(), ^(int token) { uint64_t state = UINT64_MAX; notify_get_state(token, &state); if(state == 0) { NSLog(@"unlock device"); } else { NSLog(@"lock device"); } }); }