2016-01-25 59 views

回答

0

我得到的解決方案此代碼將在後臺應用刷新和 工作當我們可以獲得應用程序在後臺的鎖定狀態。我們可以通過啓用任何背景模式來運行我們的代碼,我正在使用位置更新。

int notify_token; 
notify_register_dispatch("com.apple.springboard.lockstate",&notify_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"); 
} 
+1

我認爲這是私人API?確定看起來像 – Sirens

+1

import notify.h蘋果會批准它 –

相關問題