GCKDeviceManager协议 - didDisconnectWithError:和didDisconnectFromApplicationWithError之间有什么区别:?

时间:2016-03-04 15:51:54

标签: ios chromecast google-cast

<GCKDeviceManagerDelegate> Protocol我看到两种非常相似的方法:

/**
 * Called when the connection to the device has been terminated. It is safe to release the
 * GCKDeviceManager object from within this callback.
 *
 * @param deviceManager The device manager.
 * @param error The error that caused the disconnection; nil if there was no error (e.g. intentional
 * disconnection).
 */
- (void)deviceManager:(GCKDeviceManager *)deviceManager
    didDisconnectWithError:(NSError *)error;

/**
 * Called when disconnected from the current application.
 *
 * @param deviceManager The device manager.
 * @param error The error that caused the disconnect, or <code>nil</code> if this was a normal
 * disconnect.
 */
- (void)deviceManager:(GCKDeviceManager *)deviceManager
    didDisconnectFromApplicationWithError:(NSError *)error;

如果Chromecast接收器断开连接或与应用程序断开连接,则会调用deviceManager:didDisconnectWithError:,并且当应用程序尝试断开与Chromecast接收器的连接时调用deviceManager:didDisconnectFromApplicationWithError:

调用每个委托方法时的用例是什么?

1 个答案:

答案 0 :(得分:1)

发送方应用程序可以连接到强制转换设备,成功连接后可以在强制转换设备上启动接收方应用程序。因此,“连接到设备”和“运行应用程序”是两个单独的操作,因此“停止接收器应用程序”和“断开”与转换设备的连接。因此,有两种不同的方法。