2017-07-03 27 views
0

私は、機能を継続的に実行するタイマーを持っていますが、ユーザーがアプリケーションを終了したり、別のビューに変更したり、アプリケーションを終了したりするたびに停止します。これらのシナリオでは、どのようにタイマーをアクティブにして実行し続けることができますか?タイマーをバックグラウンドで実行するにはどうすればよいですか?

+1

https://stackoverflow.com/questions/34850390/ios-timer-in-the-background?rq=1m、https://stackoverflow.comなどの「関連する」質問をご覧になりましたか?/questions/40644452/running-a-timer-that-c​​ounts-down-in-background-when-app-isnt-the-focus-swift?rq = 1、https://stackoverflow.com/questions/41645143/time -app-can-run-in-background-swift?rq = 1、https://stackoverflow.com/questions/44416417/should-i-invalidate-timer-when-my-application-is-suspended-or-in - バックグラウンド?rq = 1? –

+1

timer.invalidate()は呼び出さずにこれを参照してください。https://stackoverflow.com/questions/8415870/scheduled-nstimer-when-app-is-in-background –

+0

これはあなたのために働いていますか? – WBuck

答えて

0

データベースに時間を保存して、ユーザーがアプリを再び開くたびに時間がかかることがあります。

関連する問題