|
ios客户端程序提交到苹果审核不通过。
anychat组件中是否有类似这些代码,监听手机锁屏?
// 判断锁屏
#import <notify.h>
#define NotificationLock CFSTR("com.apple.springboard.lockcomplete")
#define NotificationChange CFSTR("com.apple.springboard.lockstate")
#define NotificationPwdUI CFSTR("com.apple.springboard.hasBlankedScreen")
- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions {
// 锁屏的通知监听
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, screenLockStateChanged,NotificationLock,NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, screenLockStateChanged,NotificationChange,NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
return YES;
}
//设备是否锁屏
staticvoid screenLockStateChanged(CFNotificationCenterRef center,void* observer,CFStringRef name,const void* object,CFDictionaryRef userInfo){
NSString* lockstate = (__bridgeNSString*)name;
if ([lockstateisEqualToString__bridge NSString*)NotificationLock]) {
NSLog(@"锁屏");
}else{
NSLog(@"状态改变了");
}
}
|
|