iPhone - 即使idleTimerDisabled为YES,手机也会进入睡眠状态 [英] iPhone - phone goes to sleep even if idleTimerDisabled is YES

查看:98
本文介绍了iPhone - 即使idleTimerDisabled为YES,手机也会进入睡眠状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的appdelegate的applicationDidFinishLaunching:方法中使用它来确保iPhone在应用程序打开期间不会进入睡眠状态

I am using this in my appdelegate's applicationDidFinishLaunching: method to make sure the iPhone doesn't go to sleep during the time the app is open

[application setIdleTimerDisabled:YES];

它适用于所有屏幕,但在其中一个屏幕上iPhone进入睡眠状态。我无法弄清楚如何重现这一点,它似乎随机发生。

It works great on all screens but on one of the screens the iPhone goes to sleep. I could not figure out how to reproduce this and it seems to happen at random times.

有人可以告诉我如何处理这种情况。

Can someone please tell me how to handle this situation.

谢谢

推荐答案

我在整个应用程序中设置和取消设置此属性:

I set and un-set this property throughout my app using:

[UIApplication sharedApplication].idleTimerDisabled = YES;

设置这个你遇到麻烦的地方可以解决它,虽然它可能有点像一个乐队-aid解决方案。

Setting this where you're having trouble could fix it, though it might be a bit of a band-aid solution.

这篇关于iPhone - 即使idleTimerDisabled为YES,手机也会进入睡眠状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆