กำหนดค่าโปรเจ็กต์คอนโซล Google Cloud
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการกำหนดค่าโปรเจ็กต์แอปบนอุปกรณ์เคลื่อนที่และโปรเจ็กต์คอนโซล Google Cloud สำหรับ Driver
SDK ให้ทำตามขั้นตอนต่อไปนี้
- หากไม่มีโปรเจ็กต์การพัฒนาคอนโซล Google Cloud และคีย์ API
สำหรับโปรเจ็กต์การเดินทาง คุณจะต้องตั้งค่า ดูข้อมูลเพิ่มเติมได้ที่
สร้างโปรเจ็กต์ Fleet Engine
- ใน Google Cloud Console ให้เลือกโปรเจ็กต์ Google Cloud Console และ
คีย์ API เดียวกันกับที่ใช้สำหรับ Fleet Engine
- เลือก API และบริการ กรองตาม 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"];
ขั้นตอนถัดไป
สร้างโทเค็นการตรวจสอบสิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-13 UTC
[[["เข้าใจง่าย","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-09-13 UTC"],[[["\u003cp\u003eTo use the Driver SDK, you must first set up a Google Cloud console project and an API key for your mobility project if you haven't already.\u003c/p\u003e\n"],["\u003cp\u003eEnsure the same Google Cloud project and API key used for Fleet Engine are selected, and enable the Maps SDK for iOS within the APIs & Services section.\u003c/p\u003e\n"],["\u003cp\u003eIntegrate your API key into your Xcode project by adding it to \u003ccode\u003eAppDelegate\u003c/code\u003e and utilizing necessary import statements (\u003ccode\u003eGoogleMaps\u003c/code\u003e, \u003ccode\u003eGoogleRidesharingDriver\u003c/code\u003e).\u003c/p\u003e\n"]]],[],null,[]]