【发布时间】:2014-04-27 18:50:35
【问题描述】:
使用 iOS Sender API 框架,当我的应用程序进入后台时,SDK 会断开所有连接,并且在应用程序重新回到前台之前,我无法启动任何媒体。我的应用程序播放音频并允许在后台运行和流式传输。是否可以选择告诉 Googlecast 框架保持套接字打开?
这是后台日志:
INFO:将主动辞职
信息:现在在后台
FINE: -[GCKCastSocket disconnect] 断开连接
FINE: -[GCKCastSocket doTeardownWithError:] doTeardownWithError
FINE: -[GCKCastSocket doTeardownWithError:] 通知委托套接字已断开
FINE: -[GCKHeartbeatChannel didDisconnect] 已断开连接 - 必要时停止心跳计时器
FINE: -[GCKCastSocket socketDidDisconnect:withError:] socketDidDisconnect:withError: "(null)"
然后当应用程序恢复时: 信息:进入前台
FINE: -[GCKCastSocket doTeardownWithError:] doTeardownWithError
FINE: -[GCKCastSocket doTeardownWithError:] 通知委托套接字已断开
FINE: -[GCKCastSocket connectToHost:port:withTimeout:] 正在连接到端口 8009l 上的“192.168.1.4”...
INFO:已激活
FINE: -[GCKCastSocket socket:didConnectToHost:port:] socketDidConnect:
FINE: -[GCKCastSocket socketDidSecure:] socketDidSecure:
FINE: -[GCKCastSocket socket:didReadData:withTag:] 前缀读取,预期消息长度=1307
FINE: -[GCKDeviceAuthChannel didReceiveBinaryMessage:] 正版 Google 设备 didDeviceAuthenticated=YES
FINE: -[GCKDeviceManager deviceAuthChannelDidAuthenticate:] Authentic device,连接接收通道
FINE: -[GCKCastSocket socket:didReadData:withTag:] 前缀读取,预期消息长度=474
FINE: -[GCKDeviceManager receiverControlChannel:didReceiveStatusForApplication:] 加入申请(CC1AD845)可用
FINE: -[GCKDeviceManager connectAndNotifyDidConnectToApplication:launchedApplication:] 连接到应用程序 默认媒体接收器 (CC1AD845),传输 ID web-11
FINE: -[GCKCastSocket socket:didReadData:withTag:] 前缀读取,预期消息长度=135
FINE: -[GCKMediaControlChannel didReceiveTextMessage:] 收到消息:{"type":"MEDIA_STATUS","status":[],"requestId":6}
【问题讨论】:
-
您能展示一下您的 appDelegate 的代码吗?特别是您的 ApplicationDidEnterBackground 方法 - 您需要在此方法中安排后台任务。此外,请确保您持有对来自 AppDelegate 的发送者对象的引用,而不是您的视图控制器
标签: ios chromecast