ios – 由于“GCKConnectionSuspendReasonNetworkNotReachable”导致会话暂停

前端之家收集整理的这篇文章主要介绍了ios – 由于“GCKConnectionSuspendReasonNetworkNotReachable”导致会话暂停前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
观察到的行为:在开始播放音乐文件后,用户进入后台.通过强制转换播放音乐文件几分钟后,会话暂停,原因是GCKConnectionSuspendReasonNetworkNotReachable,即使发送方设备和强制转换设备都连接到正常工作的Wi-Fi连接

预期行为:会话应该继续,因为发送方应用程序具有播放音频的后台功能,并且GCKCastOptions我们已将属性suspendSessionsWhenBackgrounded设置为NO.

解决方法

您可能想要检查在 GCKRemoteDisplayChannel Class中应用程序后台后恢复

据说,

Normally when an iOS app goes to the background,all network connections are closed and all hardware encoder access is terminated. This effectively means that without special handling a Remote Display session will end upon app backgrounding.

A session can be kept alive in the background by doing the following:

  • Initialize the 07001 with initWithDevice:clientPackageName:ignoreAppStateNotifications:,specifying YES as the ignoreAppStateNotifications argument.
  • Register a background task using UIApplication beginBackgroundTaskWithExpirationHandler: to keep the app running if it is backgrounded for an amount of time controlled by iOS.

有关更多信息,您可能还需要检查Playing media while in the background using AV Foundation on iOS.

猜你在找的iOS相关文章