Chromecast V3中的customData

时间:2017-08-29 10:57:22

标签: swift chromecast

我正在尝试在方法中传递customData:

    open func queueLoad(_ queueItems: [GCKMediaQueueItem], start startIndex: UInt, playPosition: TimeInterval, repeatMode: GCKMediaRepeatMode, customData: Any?) -> GCKRequest

文件说:
 *可以使用序列化为JSON的对象  * NSJSONSerialization,或nil。

使用这行代码不起作用(接收方有nil customData)

let customdataDict = ["authorizationCode" : "1241536"];

do {
let customdata = try JSONSerialization.data(withJSONObject: customdataDict, options: .prettyPrinted)
   let request =  sessionManager.currentCastSession?.remoteMediaClient?.queueLoad([item()], start: 0, playPosition:    180,
                                                                                               repeatMode: repeatMode, customData:  customdata)
}catch{
}

0 个答案:

没有答案