本文介绍了如何防止在钩住SpringBoard时自动锁定屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序需要解锁屏幕才能执行某些功能,通常此应用程序作为后台进程运行,如何防止自动锁定?我的意思是在越狱环境中.
My application needs the screen be unlocked to do some functions, usually this app runs as background process, how can I prevent auto-lock? I mean on jailbroken environment.
为什么下面的代码不能从SpringBoard中获得?
Why does the code below can not be available from SpringBoard?
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
推荐答案
看看SpringBoard
类
此代码应在SpringBoard中运行:
This code should be run in SpringBoard:
SpringBoard *sb = [UIApplication sharedApplication];
[sb clearIdleTimer];
完成所有操作后,请记住将其重置为正常状态:
After you get things done, remember to reset it to normal state:
[sb resetIdleTimerAndUndim:YES]; // or NO if you don't want the screen dims at once.
这篇关于如何防止在钩住SpringBoard时自动锁定屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!