【文件属性】:
文件名称:iOS监听手机锁屏状态
文件大小:41KB
文件格式:PDF
更新时间:2021-01-20 09:37:26
ios 手机 手机锁屏
iPhone的锁屏监测分为两种方式监听:
1. 程序在前台,这种比较简单。直接使用Darwin层的通知就可以了:
#import
#define NotificationLock CFSTR(com.apple.springboard.lockcomplete)
#define NotificationChange CFSTR(com.apple.springboard.lockstate)
#define NotificationPwdUI CFSTR(com.apple.springboard.hasBlankedScreen)
static void