且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS 应用程序如何在后台无限期地保持 TCP 连接处于活动状态?

更新时间:2022-05-01 22:55:11

Tapbots 用 Pastebot 解决了这个问题,提示用户运行 无声背景音轨.

Tapbots solved this problem with Pastebot by prompting the user to run a silent background audio track at all times.

请注意,Apple 不赞成使用诸如使用背景音频或 VOIP API 来保持非音频或 VOIP 应用程序运行(如上文中描述的解决方法"所证明的那样)的黑客行为,因此涉足这些技术可能会被拒绝提交.

Note that Apple frowns on using hacks like employing the background audio or VOIP APIs to keep non audio or VOIP apps running (as evidenced by the 'workaround' described in the article above) so dabbling with these techniques risks rejection at the point of submission.

不幸的是,没有合法的 API 可以在后台保持连接处于活动状态.也许他们会在未来的 iOS 更新中引入一个,但您可以考虑提交 功能请求 来表达您的意见支持一下.

Unfortunately, though, there is no legal API to keep a connection alive in the background. Perhaps they'll introduce one in a future update to iOS, but you might consider submitting a feature request to voice your support for it.