ios voip app在后台运行仅10分钟

时间:2021-03-30 01:23:00

I am creating a voip application for iPhone and iPad family in which I have done following things :

我正在为iPhone和iPad系列创建一个voip应用程序,其中我做了以下事情:

  1. Added the UIBackgroundModes key in the plist file with values 'audio' and 'voip'.
  2. 在plist文件中添加了UIBackgroundModes键,其值为'audio'和'voip'。

  3. Create NSInputStream and NSOutputStream with tag NSStreamNetworkServiceTypeVoIP and scheduled them in runloop of another thread(not main thread).
  4. 使用标记NSStreamNetworkServiceTypeVoIP创建NSInputStream和NSOutputStream,并将它们安排在另一个线程(不是主线程)的runloop中。

  5. Created a background task in applicationDidEnterBackground.
  6. 在applicationDidEnterBackground中创建了一个后台任务。

  7. Added setKeepAliveTimeout handler (timeout value 600 sec).
  8. 添加了setKeepAliveTimeout处理程序(超时值600秒)。

Application relaunches when code in handler of setKeepAliveTimeout is called.

当调用setKeepAliveTimeout的处理程序中的代码时,应用程序重新启动。

Application relaunches if I dont put setKeepAliveTimeout handler ,but tries to send any signal to app after suspension(10 mins in background is completed).

应用程序重新启动,如果我没有设置setKeepAliveTimeout处理程序,但尝试在暂停后向应用程序发送任何信号(在后台完成10分钟)。

I have tried almost everything that came in my mind, Need pointers towards the solution Thanks in advance,

我已经尝试了几乎所有我想到的东西,需要指向解决方案提前谢谢,

1 个解决方案

#1


1  

It is the duty of the setKeepAliveTimeout handler to care about the connection. Thus, you should use an alive interval that is shorter than the timeout time of your connection.

setKeepAliveTimeout处理程序的职责是关心连接。因此,您应该使用比连接的超时时间短的活动间隔。

#1


1  

It is the duty of the setKeepAliveTimeout handler to care about the connection. Thus, you should use an alive interval that is shorter than the timeout time of your connection.

setKeepAliveTimeout处理程序的职责是关心连接。因此,您应该使用比连接的超时时间短的活动间隔。