Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page décrit la procédure à suivre pour commencer à créer des applications avec le SDK Maps 3D pour iOS. Le processus de configuration consiste à configurer un projet et une API Google Cloud pour les utiliser avec le SDK, puis à configurer un projet Xcode.
Suivez ces étapes avant d'ajouter votre première carte 3D à votre application.
Configurer un projet Google Cloud et une clé API
Avant de commencer à créer des applications avec le SDK Maps 3D pour iOS, vous devez configurer un projet Google Cloud et une clé API à utiliser avec le SDK Maps 3D pour iOS en suivant les étapes ci-dessous :
Dans la fenêtre Choisir les produits du package, vérifiez que GoogleMaps3D sera ajouté à votre cible principale désignée. Une fois cette étape terminée, cliquez sur Ajouter un package.
Pour vérifier votre installation, accédez au volet Général de votre cible. Dans Frameworks, Libraries, and Embedded Content (Frameworks, bibliothèques et contenu intégré), vous devriez voir les packages installés. Vous pouvez également consulter la section Dépendances du package du navigateur de projet pour vérifier le package et sa version.
Étape 3 : Ajoutez la clé API à votre application
Swift Package Manager
Ajoutez votre clé API au point d'entrée principal de votre application (ou à tout moment avant le chargement de la carte) comme suit.
Ajoutez la déclaration d'importation suivante :
importGoogleMaps3D
Ajoutez la méthode suivante. Remplacez YOUR_API_KEY par votre clé API.
Étape 4 (facultative) : Inspectez le fichier manifeste de confidentialité Apple
Apple exige des informations sur la confidentialité des applications sur l'App Store.
Le fichier manifeste de confidentialité Apple est inclus dans le bundle de ressources du SDK.
Pour vérifier que le fichier manifeste de confidentialité a été inclus et pour inspecter son contenu, créez une archive de votre application et générez un rapport sur la confidentialité à partir de l'archive.
Étapes suivantes
Maintenant que vous avez configuré un projet Google Cloud, une clé API et un projet Xcode pour une utilisation avec le SDK Maps 3D pour iOS, vous pouvez ajouter une carte 3D à votre application.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/31 (UTC).
[null,null,["Dernière mise à jour le 2025/08/31 (UTC)."],[],[],null,["\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\nThis page describes what you need to do to get set up to start building with the\nMaps 3D SDK for iOS. The setup process involves configuring a Google Cloud\nproject and API for use with the SDK, and then setting up an Xcode project.\nComplete these steps before [adding your first 3D map to your\napp](/maps/documentation/maps-3d/ios-sdk/add-a-3d-map).\n\nSet up a Google Cloud project and API key\n\nBefore you can start building with the Maps 3D SDK for iOS, you need to set up a\nGoogle Cloud project and API key to use with the Maps 3D SDK for iOS by\ncompleting the following steps:\n\nStep 1\n\nConsole \n\n1. In the Google Cloud console, on the project selector page, click\n **Create Project** to begin creating a new Cloud\n project.\n\n [Go to the project selector page](https://console.cloud.google.com/projectselector2/home/dashboard?utm_source=Docs_NewProject&utm_content=Docs_Central)\n2. Make sure that billing is enabled for your Cloud project.\n [Confirm that billing is enabled for your project](https://console.cloud.google.com/project/_/billing?utm_source=Docs_Billing&utm_content=Docs_Central).\n\n Google Cloud offers a $0.00 charge trial. The trial expires at either end of 90\n days or after the account has accrued $300 worth of charges, whichever comes first. Cancel\n anytime. For more information, see\n [Billing account credits](/maps/billing-credits) and [Billing](/maps/billing-and-pricing/billing).\n\nCloud SDK \n\n```bash\ngcloud projects create \"\u003cvar translate=\"no\"\u003ePROJECT\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 projects create`](https://cloud.google.com/sdk/gcloud/reference/projects/create)\n| **Note**: If you don't plan to keep the resources that you create in a learning exercise, create a project instead of selecting an existing project. After you finish the exercise, you can delete the project, removing all resources associated with the project.\n\nStep 2\n\nTo use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.\n\nNote that some integrations require you to enable multiple APIs/SDKs. If you are not sure which\nAPIs or SDKs to enable, try using\nthe [API Picker](/maps/documentation/api-picker), or consult the\ndocumentation for the API/SDK you want to use.\n\nTo enable one or more APIs or SDKs:\n\nConsole \n\n1. See the Google Maps Platform APIs and SDKs that you can enable by going to the Maps API\n Library page in the Cloud console:\n\n Go to the [Maps API Library\n page](https://console.cloud.google.com/project/_/google/maps-apis/api-list?utm_source=Docs_EnableAPIs&utm_content=Docs_Central)\n2. Click the API or SDK you want to enable.\n - If the button says **ENABLE**, click the button to enable the API or SDK.\n - If the button says **MANAGE**, the API or SDK is already enabled and you don't need to do anything further.\n - Clicking either button will display the dashboard for the API or SDK. (Click the **DISABLE** button to remove the API or SDK from this project.)\n\nCloud SDK\n\nThe following command enables all of the Maps, Routes, and Places APIs: \n\n```bash\ngcloud services enable \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n \"addressvalidation.googleapis.com\" \\\n \"areainsights.googleapis.com\" \\\n \"tile.googleapis.com\" \\\n \"aerialview.googleapis.com\" \\\n \"elevation-backend.googleapis.com\" \\\n \"routes.googleapis.com\" \\\n \"geocoding-backend.googleapis.com\" \\\n \"geolocation.googleapis.com\" \\\n \"maps-android-backend.googleapis.com\" \\\n \"maps-backend.googleapis.com\" \\\n \"maps-embed-backend.googleapis.com\" \\\n \"maps-ios-backend.googleapis.com\" \\\n \"mapsplatformdatasets.googleapis.com\" \\\n \"places-backend.googleapis.com\" \\\n \"roads.googleapis.com\" \\\n \"routeoptimization.googleapis.com\" \\\n \"static-maps-backend.googleapis.com\" \\\n \"street-view-image-backend.googleapis.com\" \\\n \"timezone-backend.googleapis.com\"\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 enable`](https://cloud.google.com/sdk/gcloud/reference/services/enable)\n- [`gcloud services disable`](https://cloud.google.com/sdk/gcloud/reference/services/disable)\n\nUse this command to enable the Environment APIs: \n\n```bash\ngcloud services enable \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n \"airquality.googleapis.com\" \\\n \"solar.googleapis.com\" \\\n \"pollen.googleapis.com\" \\\n \"weather.googleapis.com\"\n```\n| **Note:** Enabling Places API also enables the Places Library, Maps JavaScript API, Places SDK for Android and Places SDK for iOS.\n\nStep 3\n\nThis step only goes through the API Key creation process. If you use your API Key in\nproduction, we strongly recommend that you restrict your API key. You can find more\ninformation in the product-specific **Using API Keys** page.\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_Central)\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\nTo enable the SDK, see the [Maps 3D SDK for iOS](https://console.cloud.google.com/apis/library/mapsios.googleapis.com)\npage in the Google Cloud console. For more information about completing these\nsteps, see [Getting started with the Google Maps Platform](/maps/get-started).\n\nSet up an Xcode project\n\nThis section explains how to create and configure an Xcode project for use with\nthe Maps 3D SDK for iOS.\n\nAfter you enable billing and create an API key, you're ready to set up the Xcode\nproject that you use to develop your app.\n\nStep 1: Install the required software\n\nTo build a project using the Maps 3D SDK for iOS, you must download and install:\n\n- [Xcode](https://developer.apple.com/xcode/) **version\n 16.0** or later\n\nStep 2: Create the Xcode project and install the Maps 3D SDK for iOS \n\nSwift Package Manager\n\n\nThe Maps 3D SDK for iOS can be installed using Swift Package Manager.\n\nTo add the SDK to a new or existing project, follow these steps:\n\n- Open your Xcode `project` or `workspace`, then go to **File** \\\u003e **Add Package Dependencies**.\n- Enter \u003chttps://github.com/googlemaps/ios-maps-3d-sdk\u003e as the URL, press **Enter** to pull in the package, and click \"Add Package\".\n- From the **Choose Package Products** window, verify that `GoogleMaps3D` will be added to your designated main target. Once complete, click **Add Package**.\n- To verify your installation, navigate to your target's **General** pane. In **Frameworks, Libraries, and Embedded Content** , you should see the installed packages. You can also view the **Package Dependencies** section of **Project Navigator** to verify the package and its version.\n\nStep 3: Add the API key to your app \n\nSwift Package Manager\n\nAdd your API key to the main entry point for your app (or any time before the map loads) as follows.\n\n1. Add the following import statement: \n\n ```swift\n import GoogleMaps3D\n ```\n2. Add the following method. Replace `YOUR_API_KEY` with your API key. \n\n ```swift\n struct ContentView: View {\n init () {\n Map.apiKey = \"YOUR_API_KEY\"\n }\n\n var body: some View {\n Map(mode: .hybrid)\n }\n }\n \n ```\n| The API key can appear in your app's entry point or separately for each map view. If the API key is specified both in the entry point and the map views, however, the console will produce an error.\n\nStep 4 (optional): Inspect Apple Privacy Manifest file **Note:** The following is relevant when you deploy your app to the web store.\n\nApple requires app privacy details for apps on the App Store.\n\nThe Apple Privacy Manifest file is included in the resources bundle for the SDK.\nTo verify that the Privacy Manifest File has been included, and to inspect its\ncontents, create an archive of your app and [generate a privacy\nreport](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests#4239187)\nfrom the archive.\n\nNext steps\n\nNow that you have a Google Cloud project, API key, and Xcode project\nset up for use with the Maps 3D SDK for iOS, you can [Add a 3D map to your\napp](/maps/documentation/maps-3d/ios-sdk/add-a-3d-map)."]]