在我的应用程序运行时,如何防止iPhone屏幕变暗或者关闭?
时间:2020-03-06 14:38:41 来源:igfitidea点击:
我正在开发不需要用户输入的应用程序,但是我不希望iPhone进入省电模式。
是否可以从应用程序禁用省电功能?
解决方案
物镜
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
迅速
UIApplication.shared.isIdleTimerDisabled = true
我正在开发不需要用户输入的应用程序,但是我不希望iPhone进入省电模式。
是否可以从应用程序禁用省电功能?
物镜
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
迅速
UIApplication.shared.isIdleTimerDisabled = true