unbindPushKitToken method
~english Unbinds the Apple PushKit token bound by bindPushKitToken.
This method is available on iOS only; on other platforms it does nothing.
ChatClient.logout with unbindDeviceToken: true already unbinds the PushKit token,
so call this method only to unbind it while the current user stays logged in.
Throws A description of the issue that caused this exception. See ChatError
~end
~chinese 解绑 bindPushKitToken 绑定的苹果 PushKit token。
仅 iOS 平台有效,其他平台调用不做任何处理。
ChatClient.logout 且 unbindDeviceToken 为 true 时已经会同时解绑 PushKit token,
因此只有在当前用户保持登录状态、需要单独解绑时才需要调用本方法。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。
~end
Implementation
Future<void> unbindPushKitToken() async {
if (Platform.isIOS) {
try {
Map result = await platform_interface.Client.instance.pushManager
.callNativeMethod(ChatMethodKeys.unbindPushKitToken);
ChatError.hasErrorFromResult(result);
} catch (e) {
rethrow;
}
} else {
return;
}
}