メインコンテンツまでスキップ

サービス認証の再試行

ServiceAuthType で指定したサービスの認証を再要求します。

API Reference

Swift
/// 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?
)

retryServiceAuth を参照してください。

SwiftObjective-Cサービス
.starBurstAIBudsServiceAuthTypeStarBurstStarBurst AI(ByteDance 提供)
.onDeviceVoiceAssistantAIBudsServiceAuthTypeOnDeviceVoiceAssistantオンデバイス音声アシスタント
Swift
guard let device = device as? DeviceServiceAuthAPI else { return }
device.retryServiceAuth(.starBurst) { success, error in
    if !success { print(error?.localizedDescription ?? "Authorization retry failed") }
}

完了は再試行要求が受理されたか失敗したかを示します。サービスを認証済みとして扱う前に、更新された認証状態を読み取るか、SDK の認証コールバックを処理してください。