Konfigurowanie projektu w Google Cloud Console
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Aby skonfigurować projekt aplikacji mobilnej i projekt konsoli Google Cloud na potrzeby pakietu SDK Driver, wykonaj te czynności:
- Jeśli nie masz projektu deweloperskiego w konsoli Google Cloud ani klucza interfejsu API do projektu mobilności, musisz je skonfigurować. Więcej informacji znajdziesz w artykule Tworzenie projektu Fleet Engine.
- W konsoli Google Cloud wybierz ten sam projekt i klucz interfejsu API, których używasz w Fleet Engine.
- Wybierz Interfejsy API i usługi, odfiltruj Mapy, a następnie wyszukaj i włącz pakiet Maps SDK na iOS.
Dodawanie klucza interfejsu API do projektu
W przykładach poniżej pokazujemy, jak dodać klucz interfejsu API do projektu w Xcode:
Swift
Dodaj klucz interfejsu API do AppDelegate.swift
w ten sposób:
Dodaj te instrukcje importu:
import GoogleMaps
import GoogleRidesharingDriver
Dodaj do metody application(_:didFinishLaunchingWithOptions:)
te informacje:
GMSServices.provideAPIKey("YOUR_API_KEY")
Objective-C
Dodaj klucz interfejsu API do AppDelegate.m
w ten sposób:
Dodaj te instrukcje importu:
@import GoogleMaps;
@import GoogleGoogleRidesharingDriver;
Dodaj do metody application:didFinishLaunchingWithOptions:
te informacje:
[GMSServices provideAPIKey:@"YOUR_API_KEY"];
Co dalej?
Tworzenie tokenów uwierzytelniania
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-31 UTC.
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\u003cp\u003eSet up a Google Cloud console development project and API key for your mobility project if you don't have one already.\u003c/p\u003e\n"],["\u003cp\u003eEnable the Maps SDK for iOS within your Google Cloud console project.\u003c/p\u003e\n"],["\u003cp\u003eAdd your API key to your iOS project (\u003ccode\u003eAppDelegate\u003c/code\u003e file) using the provided code snippets for either Swift or Objective-C.\u003c/p\u003e\n"],["\u003cp\u003eAfter configuration, proceed to create authentication tokens for Driver SDK functionalities.\u003c/p\u003e\n"]]],[],null,["# Configure a Google Cloud console project\n\nTo configure your mobile app project and Google Cloud console project for the Driver\nSDK, follow these steps:\n\n1. If you don't have a Google Cloud console development project and an API key for your mobility project, you need to set one up. For more information, see [Create your Fleet Engine project](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/create-project).\n2. In the Google Cloud console, select the same Google Cloud console project and API key that you are using for Fleet Engine.\n3. Select **APIs \\& Services** , filter by **Maps**, and then search for and enable the Maps SDK for iOS.\n\nAdd your API key to the project\n-------------------------------\n\nThe following examples show how to add the API key to your project in Xcode: \n\n### Swift\n\nAdd your API key to your `AppDelegate.swift` as follows:\n\n1. Add the following import statements:\n\n import GoogleMaps\n import GoogleRidesharingDriver\n\n2. Add the following to your `application(_:didFinishLaunchingWithOptions:)`\n method:\n\n GMSServices.provideAPIKey(\"\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\")\n\n### Objective-C\n\nAdd your API key to your `AppDelegate.m` as follows:\n\n1. Add the following import statements:\n\n @import GoogleMaps;\n @import GoogleGoogleRidesharingDriver;\n\n2. Add the following to your `application:didFinishLaunchingWithOptions:`\n method:\n\n [GMSServices provideAPIKey:@\"\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\"];\n\nWhat's next\n-----------\n\n[Create authentication tokens](/maps/documentation/mobility/driver-sdk/scheduled/ios/authenticate)"]]