Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, was Sie tun müssen, um mit der Entwicklung mit dem Maps 3D SDK for iOS zu beginnen. Beim Einrichten müssen Sie ein Google Cloud-Projekt und eine API für die Verwendung mit dem SDK konfigurieren und dann ein Xcode-Projekt einrichten.
Führen Sie diese Schritte aus, bevor Sie Ihrer App die erste 3D-Karte hinzufügen.
Google Cloud-Projekt und API-Schlüssel einrichten
Bevor Sie mit der Entwicklung mit dem Maps 3D SDK for iOS beginnen können, müssen Sie ein Google Cloud-Projekt und einen API-Schlüssel für die Verwendung mit dem Maps 3D SDK for iOS einrichten. Führen Sie dazu die folgenden Schritte aus:
Prüfen Sie im Fenster Paketprodukte auswählen, ob GoogleMaps3D Ihrem primären Ziel hinzugefügt wird. Wenn Sie alles eingegeben haben, klicken Sie auf Paket hinzufügen.
Rufen Sie den Tab Allgemein des Ziels auf, um die Installation zu überprüfen. Unter Frameworks, Bibliotheken und eingebettete Inhalte sollten die installierten Pakete angezeigt werden. Sie können das Paket und seine Version auch im Bereich Package Dependencies (Paketabhängigkeiten) des Project Navigator (Projektnavigator) prüfen.
Schritt 3: API-Schlüssel in die App einfügen
Swift Package Manager
Fügen Sie Ihren API-Schlüssel folgendermaßen dem Haupteinstiegspunkt Ihrer App (oder zu einem beliebigen Zeitpunkt vor dem Laden der Karte) hinzu.
Gib die folgende Importanweisung an:
importGoogleMaps3D
Fügen Sie die folgende Methode hinzu. Ersetzen Sie YOUR_API_KEY durch Ihren API-Schlüssel.
Schritt 4 (optional): Apple-Datei mit Datenschutzmanifest prüfen
Apple verlangt Angaben zum App-Datenschutz für Apps im App Store.
Die Apple-Datenschutzmanifestdatei ist im Ressourcen-Bundle für das SDK enthalten.
Wenn Sie prüfen möchten, ob die Datenschutzmanifestdatei enthalten ist, und ihren Inhalt ansehen möchten, erstellen Sie ein Archiv Ihrer App und generieren Sie einen Datenschutzbericht aus dem Archiv.
Nächste Schritte
Nachdem Sie ein Google Cloud-Projekt, einen API-Schlüssel und ein Xcode-Projekt für die Verwendung mit dem Maps 3D SDK for iOS eingerichtet haben, können Sie Ihrer App eine 3D-Karte hinzufügen.
[null,null,["Zuletzt aktualisiert: 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)."]]