הגדרת פרויקט במסוף Google Cloud
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כדי להגדיר את פרויקט האפליקציה לנייד ואת פרויקט מסוף Google Cloud עבור Driver SDK, פועלים לפי השלבים הבאים:
- אם אין לכם פרויקט פיתוח במסוף Google Cloud ומפתח API לפרויקט הניידות, אתם צריכים להגדיר אחד. מידע נוסף זמין במאמר יצירת פרויקט Fleet Engine.
- במסוף Google Cloud, בוחרים את אותו פרויקט ואת אותו מפתח API שבהם אתם משתמשים ב-Fleet Engine.
- בוחרים באפשרות APIs & Services, מסננים לפי Maps, ואז מחפשים את Maps SDK ל-iOS ומפעילים אותו.
הוספת מפתח ה-API לפרויקט
בדוגמאות הבאות מוצגות דרכים להוספת מפתח ה-API לפרויקט ב-Xcode:
Swift
מוסיפים את מפתח ה-API ל-AppDelegate.swift
באופן הבא:
מוסיפים את הצהרות הייבוא הבאות:
import GoogleMaps
import GoogleRidesharingDriver
מוסיפים את הנתונים הבאים לשיטה application(_:didFinishLaunchingWithOptions:)
:
GMSServices.provideAPIKey("YOUR_API_KEY")
Objective-C
מוסיפים את מפתח ה-API ל-AppDelegate.m
באופן הבא:
מוסיפים את הצהרות הייבוא הבאות:
@import GoogleMaps;
@import GoogleGoogleRidesharingDriver;
מוסיפים את הנתונים הבאים לשיטה application:didFinishLaunchingWithOptions:
:
[GMSServices provideAPIKey:@"YOUR_API_KEY"];
המאמרים הבאים
יצירת טוקנים של אימות
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-17 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-17 (שעון 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,["To 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\nThe following examples show how to add the API key to your project in Xcode: \n\nSwift\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\nObjective-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[Create authentication tokens](/maps/documentation/mobility/driver-sdk/scheduled/ios/authenticate)"]]