مهم : از
1 مه 2024 ، اپل برای برنامههای iOS که از SDKهای متداول استفاده میکنند، از جمله GoogleSignIn-iOS، به مانیفستهای حریم خصوصی و امضا
نیاز دارد . قبل از 1 مه 2024 به GoogleSignIn-iOS نسخه 7.1.0+ ارتقا دهید.
راهنمای ارتقاء ما را دنبال کنید.
راهنمای مهاجرت سریع Google Sign-In
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه تغییرات کلیدی را برای نسخههای اصلی Google Sign-In SDK توضیح میدهد.
این راهنما را دنبال کنید تا برنامه خود را به آخرین نسخه Google Sign-In SDK منتقل کنید. توجه داشته باشید که اسناد همیشه به آخرین نسخه اشاره دارد.
همچنین برای اطلاعات بیشتر به یادداشت های انتشار و مخزن GitHub مراجعه کنید.
Google Sign-In SDK نسخه 7.0.0+
برای انتقال برنامه خود از نسخه Google Sign-In SDK قبل از نسخه 7.0.0، تغییرات زیر را اعمال کنید:
پیکربندی مشتری OAuth خود را در فایل Info.plist
برنامه خود تنظیم کنید. می توانید به تنظیم آن در زمان اجرا (با استفاده از یک شیء GIDConfiguration
) ادامه دهید، اما این دیگر توصیه نمی شود. برای مثال و جزئیات بیشتر به راهنمای شروع مراجعه کنید.
متد addScopes:
به GIDGoogleUser منتقل شده است. به جای درخواست دامنه های مجوز اضافی از GIDSignIn، اکنون باید پس از تکمیل احراز هویت، آنها را از GIDGoogleUser درخواست کنید .
اگر serverClientID
برای فعال کردن دسترسی API سمت سرور برای برنامه خود تنظیم می کنید، serverAuthCode
اکنون با GIDSignInResult
در تکمیل شما بازگردانده می شود.
ویژگیهای GIDAuthentication
به GIDGoogleUser
منتقل شدهاند.
به روز رسانی فراخوانی روش:
نسخه 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 Sign-In SDK نسخه 6.0.0
برای انتقال برنامه خود از نسخه Google Sign-In SDK قبل از نسخه 6.0.0، تغییرات زیر را اعمال کنید:
همه تماسهای [GIDSignIn sharedInstance]
را به دسترسیهای ویژگی GIDSignIn.sharedInstance
بهروزرسانی کنید.
تمام پیکربندی مشتری (شناسه های مشتری و غیره) را به یک شی GIDConfiguration
منتقل کنید.
تماسهای روشهای حذفشده را به معادلهای جدید خود بهروزرسانی کنید:
v5.xx | نسخه 6.0.0 |
---|
signIn | signInWithConfiguration:presentingViewController:callback: |
restorePreviousSignIn | restorePreviousSignInWithCallback: |
disconnect | disconnectWithCallback: |
getTokensWithHandler: | doWithFreshTokens: |
refreshTokensWithHandler: | doWithFreshTokens: |
تمام ارجاعات به پروتکل GIDSignInDelegate
و روش های آن را حذف کنید.
منطق را از signIn:didSignInForUser:withError:
به بلوک callback signInWithConfiguration:presentingViewController:callback:
منتقل کنید.
منطق را از signIn:didDisconnectWithUser:withError:
به بلوک callback disconnectWithCallback:
منتقل کنید.
GIDSignInButton
به صورت دستی به روشی متصل کنید که signInWithConfiguration:presentingViewController:callback:
با استفاده از یک IBAction
یا مشابه فراخوانی می کند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]