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& audio。
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屋!