gpt4 book ai didi

ios - 套接字处于后台状态 iOS

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:00:33 26 4
gpt4 key购买 nike

也许有人解决了应用程序在后台时与服务器稳定连接的问题?我需要将音频数据从服务器传输到客户端应用程序。我知道 iOS 的所有黑客如何使应用程序保持事件状态,但我需要合法的方法来解决这个问题。也许你有什么想法?我发现我可以将 VoIP 推送发送到设备,这将唤醒我的应用程序,然后建立到我的服务器的 tcp 连接,但是这个套接字将保持事件状态大约 30 秒(正如我在日志中看到的,每 3 秒在 iOS 应用程序中触发发送的计时器数据到服务器)这对我来说还不够。

最佳答案

也许这个项目https://github.com/SmallSharpToolsOpenSource/Speakerbox会对某人有帮助。还有这个视频https://www.youtube.com/watch?v=lXJ1LDjL4Os

Apple 技术支持的官方回答:

PushKit is how voip apps can reliable receive silent notifications, while CallKit is basically a UI framework voip apps can use to notify the user about calls. Note that there is NOT any direct connection within the APIs- for example, a voip app can generate a local notification (instead of using CallKit) or simply do nothing and “ignore” the notification entirely. Similarly, a voip app could “fake” a call at anytime by simply telling CallKit that there was an incoming call (our sample code for CallKit did exactly this).

Anything your app could previously have done when it received voip socket traffic, it could also do when it received a PushKit notification.

Standard voip apps actually operate in two COMPETELY unrelated “modes”:

1) While waiting for an incoming call, the app is suspended until “something” (PushKit OR a voip socket) wakes the app to tell it about the call.

2) Once a call has started, the app has an active audio session and is relying an the standard “background audio” behavior of iOS, just like a wide variety of other audio apps (for example, any streaming music app).

关于ios - 套接字处于后台状态 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53535146/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com