サービス認証の再試行
ServiceAuthType で指定したサービスの認証を再要求します。
API Reference
- 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(ByteDance 提供) |
.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 の認証コールバックを処理してください。