idleTimerDisabled not working since iPhone 3.0

前端 未结 5 1794
無奈伤痛
無奈伤痛 2020-12-02 21:09

I have used:

[UIApplication sharedApplication].idleTimerDisabled = YES;

in a number of Apps developed and running under iPhone OS 2.x and n

5条回答
  •  暖寄归人
    2020-12-02 21:59

    I develop Seconds - Interval Timer for iPhone and iPod touch and I've had no end of trouble with this. The idea of my app is that people create timers based on a number of intervals where each interval can have it's own playlist or track played.

    In iOS3 I had the problem that I couldn't disable the idle timer by just setting idleTimerDisabled = YES. In the end I came up with the same solution as Neil whereby I would periodically set it to NO, then immediately to YES again. This seemed to work.

    I'm now updating the app to iOS4 (I know, iOS5 is just around the corner...) and now I have the opposite problem. If the MPMediaPlayer changes track before the idle timer reaches it's limit it gets reset. I've just tested this by creating an interval in my app that was 55 seconds, my auto-lock was set to a minute. At 50 seconds the screen dimmed as it prepared to lock, but at 55 seconds when the music changed it went back to full brightness and then didn't lock as it should.

    Overall, the implementation of this seems flakey at best.

提交回复
热议问题