setKeepAliveTimeout iOS行为,在300秒内超过15次唤醒 [英] setKeepAliveTimeout iOS behavior, exceeded 15 wakes in 300 sec

查看:462
本文介绍了setKeepAliveTimeout iOS行为,在300秒内超过15次唤醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在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
  • 此VOIP套接字由系统维护,而应用程序暂停在BG
  • 您可以安排一个保持活动的块,操作系统会每隔X次唤醒您的应用程序
  • X> = 10min(参见[[UIApplication sharedApplication] setKeepAliveTimeout:handler :)
  • 此套接字不是媒体套接字,它仅用于接收来电邀请
  • 应用程序唤醒套接字上的每个传入数据(iOS 5.0+限制为300次,15次) )
  • 一旦收到来电,你的应用程序就会被唤醒,你可以为这个电话打开一个音频会话。

    VOIP app behavior at background (iOS 4.0+):

  • Having a single socket that remains open, flagged as Voip
  • This VOIP socket is maintained by the system, while app suspended at BG
  • You may schedule a keep-alive block, and the OS will wake your app every X time
  • X >= 10min (See [[UIApplication sharedApplication] setKeepAliveTimeout: handler:)
  • this socket is NOT the media socket, it uses only to receive invitations for incoming calls
  • App wake up on every incoming data on the socket (iOS 5.0+ limit is 15 times in 300 seconds)
  • Once you've received an incoming call, your app will wake up, and you may open an Audio Session for this call.

    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屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆