สำคัญ: ตั้งแต่วันที่
1 พฤษภาคม 2024 เป็นต้นไป Apple จะ
กำหนดให้ใช้ไฟล์ Manifest ด้านความเป็นส่วนตัวและลายเซ็นสำหรับแอปพลิเคชัน iOS ที่ใช้ SDK ที่ใช้กันโดยทั่วไป ซึ่งรวมถึง GoogleSignIn-iOS อัปเกรดเป็น GoogleSignIn-iOS v7.1.0 ขึ้นไปก่อนวันที่ 1 พฤษภาคม 2024 ทำตาม
คู่มือการอัปเกรด
คำแนะนำในการย้ายข้อมูลฉบับย่อของ Google Sign-In
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้แสดงรายละเอียดการเปลี่ยนแปลงที่สำคัญของ Google Sign-In SDK เวอร์ชันหลัก
ทำตามคำแนะนำนี้เพื่อย้ายข้อมูลแอปไปยัง SDK การลงชื่อเข้าใช้ของ Google
เวอร์ชันล่าสุด โปรดทราบว่าเอกสารประกอบจะกล่าวถึงเวอร์ชันล่าสุดเสมอ
ดูข้อมูลเพิ่มเติมได้ที่บันทึกประจำรุ่นและที่เก็บบน GitHub
SDK การลงชื่อเข้าใช้ Google เวอร์ชัน 7.0.0 ขึ้นไป
หากต้องการย้ายข้อมูลแอปจาก Google Sign-In SDK เวอร์ชันก่อน v7.0.0 ให้ทำการเปลี่ยนแปลงต่อไปนี้
ตั้งค่าการกำหนดค่าไคลเอ็นต์ OAuth ในไฟล์ Info.plist
ของแอปพลิเคชัน
คุณจะตั้งค่าต่อไปในระหว่างรันไทม์ (โดยใช้ออบเจ็กต์ GIDConfiguration
) ได้ แต่เราไม่แนะนำให้ทำเช่นนี้อีกต่อไป ดูตัวอย่างและรายละเอียดเพิ่มเติมได้จากคู่มือเริ่มต้นใช้งาน
เมธอด addScopes:
ได้ย้ายไปที่ GIDGoogleUser แล้ว แทนที่จะขอขอบเขตการให้สิทธิ์เพิ่มเติมจาก GIDSignIn คุณควรขอขอบเขตการให้สิทธิ์จาก GIDGoogleUser หลังจากการตรวจสอบสิทธิ์เสร็จสมบูรณ์แล้ว
หากคุณตั้งค่า serverClientID
ให้เปิดใช้การเข้าถึง API ฝั่งเซิร์ฟเวอร์สําหรับแอปของคุณ ตอนนี้ระบบจะส่งคืน serverAuthCode
พร้อมกับ GIDSignInResult
เมื่อดำเนินการเสร็จสมบูรณ์
ย้ายที่พักจาก GIDAuthentication
ไปยัง GIDGoogleUser
แล้ว
อัปเดตการเรียกใช้เมธอด:
v6.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:
|
SDK การลงชื่อเข้าใช้ Google เวอร์ชัน 6.0.0
หากต้องการย้ายข้อมูลแอปจาก Google Sign-In SDK เวอร์ชันก่อน v6.0.0 ให้ทำการเปลี่ยนแปลงต่อไปนี้
อัปเดตการเรียกทั้ง [GIDSignIn sharedInstance]
รายการไปยัง
การเข้าถึงพร็อพเพอร์ตี้ GIDSignIn.sharedInstance
ย้ายการกำหนดค่าไคลเอ็นต์ทั้งหมด (รหัสไคลเอ็นต์ ฯลฯ) ไปยังออบเจ็กต์ GIDConfiguration
อัปเดตการเรียกวิธีการที่นำออกไปแล้วไปยังรายการที่เทียบเท่าใหม่:
v5.x.x |
v6.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:
เชื่อมต่อ GIDSignInButton
ด้วยตนเองกับเมธอดที่เรียกใช้ signInWithConfiguration:presentingViewController:callback:
โดยใช้ IBAction
หรือที่คล้ายกัน
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThis page provides migration guides for updating your app to the latest Google Sign-In SDK versions (v7.0.0+ and v6.0.0).\u003c/p\u003e\n"],["\u003cp\u003eFor v7.0.0+, OAuth client configuration should be set in \u003ccode\u003eInfo.plist\u003c/code\u003e, additional scopes are requested from \u003ccode\u003eGIDGoogleUser\u003c/code\u003e, and various properties and methods have been moved or updated.\u003c/p\u003e\n"],["\u003cp\u003eMigrating to v6.0.0 involves using \u003ccode\u003eGIDConfiguration\u003c/code\u003e for client configuration, updating method calls, and replacing \u003ccode\u003eGIDSignInDelegate\u003c/code\u003e with callback blocks.\u003c/p\u003e\n"],["\u003cp\u003eDetailed information and examples are available in linked resources like release notes, GitHub repository, and the "Get Started" guide.\u003c/p\u003e\n"]]],[],null,["# Google Sign-In quick migration guide\n\nThis page details key changes for major versions of the Google Sign-In SDK.\n\nFollow this guide to migrate your app to the latest version of the Google\nSign-In SDK. Note that the documentation always refers to the most recent\nversion.\n\nAlso refer to the [release notes](/identity/sign-in/ios/release) and the\n[repository on GitHub](https://github.com/google/GoogleSignIn-iOS)\nfor more information.\n\nGoogle Sign-In SDK v7.0.0+\n--------------------------\n\nTo migrate your app from a version of the Google Sign-In SDK prior to v7.0.0,\nmake the following changes:\n\n- Set your OAuth client configuration in your application's `Info.plist` file.\n You can continue to set it at runtime (using a `GIDConfiguration`) object,\n but this is no longer recommended. See the [get\n started](/identity/sign-in/ios/start-integrating#configure_app_project) guide for\n examples and more details.\n\n | `Info.plist` key | Description |\n |---------------------|-------------------------------------------------------------------------------------------------------------------|\n | `GIDClientID` | [OAuth client ID](/identity/sign-in/ios/start-integrating#add_client_id) |\n | `GIDServerClientID` | [Server OAuth client ID for backend authentication](/identity/sign-in/ios/start-integrating#add_server_client_id) |\n | `GIDHostedDomain` | [Google Workspace domain](/identity/sign-in/ios/start-integrating#add_domain_realm) |\n | `GIDOpenIDRealm` | [OpenID realm](/identity/sign-in/ios/start-integrating#add_domain_realm) |\n\n- The `addScopes:` method has been moved to GIDGoogleUser. Instead of\n requesting additional authorization scopes from GIDSignIn, you should now\n [request them from GIDGoogleUser after authentication](/identity/sign-in/ios/api-access#2_request_additional_scopes)\n has completed.\n\n- If you are setting `serverClientID` to [enable server-side API access for\n your app](/identity/sign-in/ios/offline-access), `serverAuthCode` will now be\n returned with `GIDSignInResult` in your completion.\n\n- Properties from `GIDAuthentication` have moved into `GIDGoogleUser`.\n\n- Update method calls:\n\n| v6.2.x | v7.0.0+ |\n|--------------------------------------------------------------------------|------------------------------------------------------------------|\n| `GIDSignIn` `signInWithConfiguration:presentingViewController:callback:` | `GIDSignIn` `signInWithPresentingViewController:completion:` |\n| `GIDSignIn` `restorePreviousSignInWithCallback:` | `GIDSignIn` `restorePreviousSignInWithCompletion:` |\n| `GIDSignIn` `disconnectWithCallback:` | `GIDSignIn` `disconnectWithCompletion:` |\n| `GIDAuthentication` `doWithFreshTokens:` | `GIDGoogleUser` `refreshTokensIfNeededWithCompletion:` |\n| `GIDSignIn` `addScopes:presentingViewController:callback:` | `GIDGoogleUser` `addScopes:presentingViewController:completion:` |\n\nGoogle Sign-In SDK v6.0.0\n-------------------------\n\nTo migrate your app from a version of the Google Sign-In SDK prior to v6.0.0,\nmake the following changes:\n\n- Update all `[GIDSignIn sharedInstance]` calls to `GIDSignIn.sharedInstance`\n property accesses.\n\n- Move all client configuration (client IDs, etc.) to a `GIDConfiguration`\n object.\n\n- Update calls to removed methods to their new equivalents:\n\n | v5.x.x | v6.0.0 |\n |-----------------------------|--------------------------------------------------------------|\n | `signIn` | `signInWithConfiguration:presentingViewController:callback:` |\n | `restorePreviousSignIn` | `restorePreviousSignInWithCallback:` |\n | `disconnect` | `disconnectWithCallback:` |\n | `getTokensWithHandler:` | `doWithFreshTokens:` |\n | `refreshTokensWithHandler:` | `doWithFreshTokens:` |\n\n- Remove all references to the `GIDSignInDelegate` protocol and its methods.\n\n - Move the logic from `signIn:didSignInForUser:withError:` to the callback\n block of `signInWithConfiguration:presentingViewController:callback:`.\n\n - Move the logic from `signIn:didDisconnectWithUser:withError:` to the\n callback block of `disconnectWithCallback:`.\n\n- Manually connect `GIDSignInButton` to a method that calls\n `signInWithConfiguration:presentingViewController:callback:` using an\n `IBAction` or similar."]]