0

我有一个应用程序通过 UDP 连接到网络设备(在 LAN 中)并使用 GCDAsyncUdpSocket 侦听新消息。它在前台工作正常,但在后台无法响应。当我收到来自 UDP 的消息时,我想显示本地通知。请建议我们如何通过遵循 Apple 政策来实现这一目标。

谢谢和问候, 阿米特

4

1 回答 1

0

All sockets are set to sleep when the app is in background.

The option you have is to do Fetching Small Amounts of Content Opportunistically

In case your app is a VoIP app, you can keep a TCP socket live and the OS will inform you when data is received. This way you can set a "wake up" message to be sent over TCP and then use UDP for the actual data transfer.

于 2016-02-24T00:15:42.157 回答