setKeepAliveTimeout iOS 行为,在 300 秒内超过 15 次唤醒 [英] setKeepAliveTimeout iOS behavior, exceeded 15 wakes in 300 sec
问题描述
我正在 iOS 5 上编写 VOIP 应用程序,我试图了解实际通信如何在后台保持活动状态.
I am writing a VOIP application on iOS 5 and I am trying to understand how the actual communication can stay alive while in the background.
我知道套接字在单位时间内可以获得的最大唤醒次数.我的问题是我的套接字连接收到太多唤醒消息,因为应用程序因崩溃消息而终止:
I understand there is a maximum amount of wakes the socket can get per amount of time. My problem is that my socket connection receive too many wakes messages, because of that the app is terminated with crash message:
在 300 秒内超过 15 次唤醒
exceeded 15 wakes in 300 sec
我真正不明白的是,如果每段时间可以接收的数据量有限制,那么套接字应该如何通过它不断发送和接收数据(用于 VOIP 需求)?
What I really don't understand is how is the socket supposed to be able to constantly send and receive data through it (for VOIP needs) if there is a limit for the amount of data it can receive per amount of time?
假设套接字正在接收在后台进行的语音对话的语音数据.语音数据不是应该通过套接字连接吗?如果是这样,如果套接字在单位时间内可以进行的活动有限制,它如何工作?
Let's say the socket is receiving voice data for a voice conversation that is happening while in the background. Is it not that voice data supposed to go through the socket connection? If so, how can it work if there is a limit for the activity the socket can have per amount of time?
推荐答案
后台 VOIP 应用行为(iOS 4.0+):
VOIP app behavior at background (iOS 4.0+):
VOIP 应用程序应在 info.plist 中的必需的后台模式"下进行标记,作为语音"&音频".
VOIP apps should be flagged at info.plist, under "Required background modes", as "voip" & "audio".
打开音频会话后(用于主动呼叫),您的应用程序可能会在后台完全运行并且不再暂停,直到此音频会话关闭.
无论如何,另一种选择是使用推送通知作为来电的触发器.
此外,这将为您省去 24/7 全天候维护插座的麻烦,节省一些电池,
并且即使用户关闭了应用程序也能工作(第一种选择不是这种情况).
Anyway, the other alternative, is to use Push notifications as triggers for incoming calls.
Also, this will save you the trouble of maintaining a socket 24/7, save some battery,
and will work even if the user has closed the app (which is not the case with the first alternative).
这篇关于setKeepAliveTimeout iOS 行为,在 300 秒内超过 15 次唤醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!