監測iphone變暗或者變亮

#import <notify.h>int status = notify_register_dispatch("com.apple.springboard.hasBlankedScreen",
                                          &notifyToken,                dispatch_get_main_queue(),^(int t){
                                          uint64_t state;
                                          int result = notify_get_state(notifyToken,&state);
                                          NSLog(@"lock state change = %llu", state);
                                          if(result != NOTIFY_STATUS_OK){
                                                NSLog(@"notify_get_state() not returning NOTIFY_STATUS_OK");}});
                                                if(status != NOTIFY_STATUS_OK){
                                                    NSLog(@"notify_register_dispatch() not returning NOTIFY_STATUS_OK");
                                                }                                          }                                 })
相關文章
相關標籤/搜索