开发者

setIdleTimerDisabled and MPMusicPlayer Issue

开发者 https://www.devze.com 2023-02-19 12:40 出处:网络
Ok I want to disable the idletimer in my app. I put the code below in appdelegate in the applicationDidFinishLaunching method, and it works fine (the device remains unlocked)

Ok I want to disable the idletimer in my app. I put the code below in appdelegate in the applicationDidFinishLaunching method, and it works fine (the device remains unlocked)

[application setIdleTimerDisabled:YES];

Though, when I play a music through MPMusicPlayer methods, the idletimer seems to be enabled back again... and soon the device goes into dimmed mode and soon after, "locked" mode.

I tried to find in google for other methods, but ultimately there are NONE that are effective. I also tried putting the above code in another function and calling that function every seconds using NSTimer when the music is playing, but to no avail. It just won't w开发者_JS百科ork.

How can I solve this issue?


Ugh. I hate answering my own questions. But here you go, the answer is here: How to stop MPMusicPlayerController from enabling screen locking

See the reply from henning. Works like a charm!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号