相当于后台音频应用程序的 NSTimer?
我有一个视频流应用程序,已正确设置为在设备锁定或在后台时通过 AirPlay 播放视频。效果很好。然而,当应用程序进入后台时,有一件事不起作用,那就是我用 NSTimer 每 10 秒向服务器发送一次更新。我读过无数关于当应用程序在后台时 NSTimers 不工作的帖子。有很多建议的黑客和拼凑,但我没有找到正确的方法来做到这一点,或者甚至没有找到正确的方法。
但是,由于我的应用程序是一个允许进行某些后台处理的音频应用程序,因此我希望可能有某种方法可以定期将帖子发送到远程服务器。
有没有更好的方法来做到这一点?
谢谢, 克雷格
I have a video streaming app that is properly set up to play video via AirPlay while the device is locked or in the background. It works great. However, the one thing that doesn't work when the app goes into the background is the NSTimer I use to send an update back to a server once every 10 seconds. I've read through countless posts about NSTimers not working when an app is in the background. There are lots of proposed hacks and kludges, but I didn't find the proper way to do this, or if there even is a proper way.
However, since mine is an audio app where some background processing is permitted, I would expect there might be some way to periodically send a post to a remote server.
Is there a preferred way to do this?
Thanks,
Craig
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论