Google ログインのクイック移行ガイド

このページでは、Google ログイン SDK のメジャー バージョンの重要な変更点について詳しく説明します。

このガイドに沿って、アプリを最新バージョンの Google ログイン SDK に移行してください。ドキュメントでは、常に最新バージョンを参照しています。

詳細については、リリースノートGitHub のリポジトリをご覧ください。

Google ログイン SDK v7.0.0

v7.0.0 より前のバージョンの Google ログイン SDK からアプリを移行するには、次の変更を行います。

バージョン 6.2.x バージョン 7.0.0
GIDSignIn
signInWithConfiguration:presentingViewController:callback:
GIDSignIn
signInWithPresentingViewController:completion:
GIDSignIn
restorePreviousSignInWithCallback:
GIDSignIn
restorePreviousSignInWithCompletion:
GIDSignIn
disconnectWithCallback:
GIDSignIn
disconnectWithCompletion:
GIDAuthentication
doWithFreshTokens:
GIDGoogleUser
refreshTokensIfNeededWithCompletion:
GIDSignIn
addScopes:presentingViewController:callback:
GIDGoogleUser
addScopes:presentingViewController:completion:

Google ログイン SDK v6.0.0

v6.0.0 より前のバージョンの Google ログイン SDK からアプリを移行するには、次の変更を行います。

  • GIDSignIn.sharedInstance プロパティ アクセスへのすべての [GIDSignIn sharedInstance] 呼び出しを更新します。

  • すべてのクライアント構成(クライアント ID など)を GIDConfiguration オブジェクトに移動します。

  • 削除されたメソッドの呼び出しを、同等の同等のメソッドに更新します。

    バージョン 5.x.x バージョン 6.0.0
    signIn signInWithConfiguration:presentingViewController:callback:
    restorePreviousSignIn restorePreviousSignInWithCallback:
    disconnect disconnectWithCallback:
    getTokensWithHandler: doWithFreshTokens:
    refreshTokensWithHandler: doWithFreshTokens:
  • GIDSignInDelegate プロトコルとそのメソッドへの参照をすべて削除します。

    • ロジックを、signIn:didSignInForUser:withError: から signInWithConfiguration:presentingViewController:callback: のコールバック ブロックに移動します。

    • ロジックを、signIn:didDisconnectWithUser:withError: から disconnectWithCallback: のコールバック ブロックに移動します。

  • IBAction などを使用して signInWithConfiguration:presentingViewController:callback: を呼び出すメソッドに、手動で GIDSignInButton を接続します。