Can I retain a socket connection in the background for longer than 30 seconds?

拟墨画扇 提交于 2020-01-25 06:51:04

问题


I am experiencing a difficulty with background socket connections under iOS 13. I have been using UIApplication.shared.beginBackgroundTask{ ... } to make sure my socket connection survives app's transitioning to background[1]. Up to iOS 12 this gave me a few minutes of background activity, which worked just fine. As of iOS 13 this is no longer the case. Under iOS 13 the old API gives me only a 30-second background task, while I need up to 2 minutes of uninterrupted socket connectivity. I have taken a look at the new APIs (there's a WWDC19 talk), but it seems nothing suits my needs. The new APIs are executed at a system-friendly time and duration.

[1] It is required by the business case that I establish a socket connection and then the user switches to another app of which I have no control of (it can be almost any app).

来源:https://stackoverflow.com/questions/59718332/can-i-retain-a-socket-connection-in-the-background-for-longer-than-30-seconds

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!