Повторная авторизация сервиса
Запросите ещё одну попытку авторизации для ServiceAuthType.
Справочник API
- Swift
- Objective-C
/// Retries authentication for the specified service.
/// - Parameters:
/// - service: The service whose authentication should be retried.
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
func retryServiceAuth(
_ service: ServiceAuthType,
completion: AIBudsCompletionHandler?
)/// Retries authentication for the specified service.
- (void)retryServiceAuth:(enum AIBudsServiceAuthType)service
completion:(AIBudsCompletionHandler _Nullable)completion;См. retryServiceAuth.
| Swift | Objective-C | Сервис |
|---|---|---|
.starBurst | AIBudsServiceAuthTypeStarBurst | Сервис StarBurst AI |
.onDeviceVoiceAssistant | AIBudsServiceAuthTypeOnDeviceVoiceAssistant | Офлайн-голосовой помощник |
- Swift
- Objective-C
guard let device = device as? DeviceServiceAuthAPI else { return }
device.retryServiceAuth(.starBurst) { success, error in
if !success { print(error?.localizedDescription ?? "Authorization retry failed") }
}id<AIBudsDeviceServiceAuthAPI> device = (id<AIBudsDeviceServiceAuthAPI>)self.device;
if ([device conformsToProtocol:@protocol(AIBudsDeviceServiceAuthAPI)]) {
[device retryServiceAuth:AIBudsServiceAuthTypeStarBurst
completion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(@"%@", error.localizedDescription);
}
}];
}Завершение сообщает, принят ли повторный запрос. Прежде чем считать сервис авторизованным, получите обновлённое состояние или обработайте колбэки авторизации SDK.