AnyChat技术支持论坛

标题: anychat组件中是否有类似这些代码,监听手机锁屏? [打印本页]

作者: lincy    时间: 2017-4-28 17:37
标题: anychat组件中是否有类似这些代码,监听手机锁屏?
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(@"状态改变了");
    }
   
}

作者: lincy    时间: 2017-4-28 17:46
版本,AnyChatCoreSDK_Win32_r4509
作者: 佰锐科技-梁国桦    时间: 2017-4-28 21:26
lincy 发表于 2017-4-28 17:46
版本,AnyChatCoreSDK_Win32_r4509

抱歉,这么迟才回复,你可以下载我们最新版的SDK来试试,我觉得应该不是我们的SDK控制不锁屏吧,我觉得可能是IOS的设计就是这样吧




欢迎光临 AnyChat技术支持论坛 (http://bbs.anychat.cn/) Powered by Discuz! X3