本文介绍了在后台运行NSTimer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用是体育应用.即使在后台游戏也应该继续,我为此使用了nstimer.但是我无法在后台运行计时器.每当应用在后台运行时,计时器就会停止运行,返回时会从离开的同一时间开始计时.
My app is a sports app. In which the game should continue even in background, i have used nstimer for that. But I am not able to run the timer in background. whenever the app is in background the timer stops and when return it continues from same time from which it has left.
推荐答案
您不能在后台运行NSTimer
-除非您的应用程序具有在后台播放音频的许可并且它继续播放音频,否则它将始终被挂起.直到背景音频停止播放,计时器才会暂停.
you cannot run a NSTimer
in background - it will always be suspended unless you application have permission of playing audio in background and it continues playing audio. Till the time your background audio stops, your timer will pause..
这篇关于在后台运行NSTimer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!