تاریخ آخرین بهروزرسانی 2025-07-23 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-23 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eAn API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes, and you must have at least one for your project.\u003c/p\u003e\n"],["\u003cp\u003eYou can create an API key through the Google Cloud Console or by using the Cloud SDK.\u003c/p\u003e\n"],["\u003cp\u003eGoogle strongly recommends restricting your API keys to enhance security by limiting their usage to only the necessary APIs for your application.\u003c/p\u003e\n"],["\u003cp\u003eYou can restrict API keys by application and API, with application restrictions taking precedence.\u003c/p\u003e\n"],["\u003cp\u003eOnce you have obtained your API key, you can proceed to create and configure your Xcode project for Maps SDK for iOS.\u003c/p\u003e\n"]]],["API keys authenticate project requests for usage and billing. To create one, navigate to the Google Maps Platform Credentials page and click \"Create credentials \u003e API key\", or use the `gcloud services api-keys create` command. Restricting keys is vital for security; use the console or `gcloud` commands to limit usage by selecting the \"Maps SDK for iOS\" and specifying iOS bundle identifiers. Remember, you are liable for charges from unrestricted key abuse.\n"],null,["Getting an API Key \nSelect platform: [Android](/maps/documentation/android-sdk/get-api-key \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/get-api-key \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/get-api-key \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nNow that you've [set up billing and a project](/maps/documentation/ios-sdk/begin), [enabled the SDK](/maps/documentation/ios-sdk/begin),\nand [installed your preferred dependency manager and other software](/maps/documentation/ios-sdk/begin), you're\nprepared to create, add, and restrict your API key.\n\n\nCreating API keys\n\nThe API key is a unique identifier that authenticates requests associated with your project for\nusage and billing purposes. You must have at least one API key associated with your project.\n\nTo create an API key:\n\nConsole \n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_CreateAPIKey&utm_content=Docs_maps-ios-backend)\n2. On the **Credentials** page, click **Create credentials \\\u003e API key** . \n The **API key created** dialog displays your newly created API key.\n3. Click **Close.** \n The new API key is listed on the **Credentials** page under **API keys** . \n (Remember to [restrict the API](/maps/api-security-best-practices#restricting-api-keys) key before using it in production.)\n\nCloud SDK \n\n```bash\ngcloud services api-keys create \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n --display-name \"\u003cvar translate=\"no\"\u003eDISPLAY_NAME\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys create`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/create)\n\nYou need this API key when you create your Xcode project as described in\n[Set up an Xcode Project](/maps/documentation/ios-sdk/config).\n| **Note:** You can use the same API key for your [Maps SDK for iOS](/maps/documentation/ios-sdk) and [Places SDK for iOS](/maps/documentation/places/ios-sdk) apps.\n\n\nRestricting API keys\n\n\u003cbr /\u003e\n\n\nGoogle strongly recommends that you restrict your API keys by limiting their usage to those only\nAPIs needed for your application. Restricting API keys adds security to your application by\nprotecting it from unwarranted requests. **You are financially responsible for charges caused by abuse of unrestricted API keys.** For more information, see\n[API security best practices](/maps/api-security-best-practices#restrict_apikey).\n\n| When restricting an API key in the Cloud console, **Application restrictions** override any APIs enabled under **API restrictions**. Follow best practices by creating a separate API key for each app, and for each platform on which that app is available.\n\nTo restrict an API key:\n\nConsole\n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_RestrictAPIKey&utm_content=Docs_maps-ios-backend)\n2. Select the API key that you want to set a restriction on. The API key property page appears.\n3. Under **Key restrictions**, set the following restrictions:\n - Application restrictions:\n 1. Select **iOS apps**.\n 2. To accept requests from the iOS app with the bundle identifier that you supply, select the appropriate iOS bundle identifier from the list.\n - API restrictions:\n 1. Click **Restrict key**.\n 2. Select **Maps SDK for iOS** from **Select APIs** dropdown. If the Maps SDK for iOS is not listed, you need to [enable](/maps/documentation/ios-sdk/cloud-setup#enabling-apis) it.\n4. To finalize your changes, click **Save** . \n\nCloud SDK\n\n\nList existing keys. \n\n```bash\ngcloud services api-keys list --project=\"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\n\nClear existing restrictions on existing key. \n\n```bash\ngcloud services api-keys update \"projects/\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e/keys/\u003cvar translate=\"no\"\u003eKEY_ID\u003c/var\u003e\" \\\n --clear-restrictions\n```\n\n\nSet new restrictions on existing key. \n\n```bash\ngcloud services api-keys update projects/PROJECT/locations/global/keys/KEY_ID \\\n --api-target=service=maps-ios-backend.googleapis.com\n --allowed-bundle-ids=\"\u003cvar translate=\"no\"\u003eBUNDLE_NAME\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys update`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/update)\n- [`gcloud services api-keys lookup`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/lookup)\n- [`gcloud services api-keys list`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list)\n\nNow that you've gotten your API key for Maps SDK for iOS, you're ready to [get started](/maps/documentation/ios-sdk/start).\n\nWhat's next\n\nNow that you have an API key, create and configure your Xcode project as\ndescribed in [Set up an Xcode Project](/maps/documentation/ios-sdk/config)."]]