يعرض التطبيق التجريبي لحزمة تطوير البرامج (SDK) للأماكن لنظام التشغيل iOS على
GitHub
المزوّد بحزمة تطوير البرامج (SDK) للأماكن لنظام التشغيل iOS
عددًا من الميزات، بما في ذلك ميزة الإكمال التلقائي للأماكن وصور الأماكن. بالإضافة إلى ذلك، يمكنك العثور على مقتطفات من الرموز البرمجية في كل صفحة من دليل المطوّر هذا.
استورِد
التطبيق وأنشِئه، وأضِف مفتاح واجهة برمجة التطبيقات، وشاهِد العرض التجريبي، واستخدِم نموذج الرمز المقدَّم كنقطة بدء لتطبيقك.
عند تشغيل نموذج التطبيق، يعرض قائمة بالنماذج المتاحة التي يمكنك
تشغيلها على جهازك. حدِّد أحد الخيارات.
تشغيل نموذج التطبيق الكامل على الجهاز
يتوفّر تطبيق Places SDK لنظام التشغيل iOS كملف
أرشيف للتنزيل
من GitHub
اتّبِع الخطوات التالية لتثبيت تطبيق Places SDK لنظام التشغيل iOS وتجربته.
إذا تعذّر إنشاء حزمة التطبيق أو تعطّل مع ظهور خطأ بشأن مفتاح واجهة برمجة التطبيقات
عند تشغيله لأول مرة، تأكَّد من تقديم مفاتيح
المطلوبة في ملف SDKDemoAPIKey.
إذا كنت بصدد تشغيل نماذج GooglePlaces، ستعرض نافذة محاكي iOS
قائمة بالعروض التوضيحية لـ Places.
إذا طُلب منك السماح لتطبيق GooglePlacesDemos بالوصول إلى موقعك الجغرافي، اختَر
السماح.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Places SDK for iOS provides a demo app showcasing features like place autocomplete and place photos, with code snippets and a full sample app for exploration.\u003c/p\u003e\n"],["\u003cp\u003eTo run the sample app, download the archive, navigate to the GooglePlaces directory, install dependencies using CocoaPods, and open the Xcode workspace.\u003c/p\u003e\n"],["\u003cp\u003eBefore building, enable the Places SDK for iOS in your Google Cloud project, obtain an API key (restricting it to the app's bundle identifier for security), and add your API key to the \u003ccode\u003eSDKDemoAPIKey\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eBuild and run the app, granting location access if prompted, to explore the available Places Demos and utilize the provided sample code as a starting point for your own applications.\u003c/p\u003e\n"]]],[],null,["# Places SDK for iOS code samples\n\nSelect platform: [Android](/maps/documentation/places/android-sdk/examples \"View this page for the Android platform docs.\") [iOS](/maps/documentation/places/ios-sdk/examples \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/examples \"View this page for the JavaScript platform docs.\")\n\nThe Places SDK for iOS demo app on\n[GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps)\nsupplied with the Places SDK for iOS\ndemonstrate a number of features including place autocomplete, and place photos. In\naddition, you can find code snippets on each page of this developer's guide.\nImport and build the\napp, add your API key, view the demo, and use the sample code supplied as a\nstarting point for your app.\n\nWhen you run the sample app, it displays a list of available samples that you can\nrun on your own device. Select one of the options.\n| **Troubleshooting:** If the sample app runs successfully but you don't see a map, check that you've added your API key to the app's manifest file, as described in [Using API Keys](/maps/documentation/places/ios-sdk/get-api-key).\n\nRun the full sample app locally\n-------------------------------\n\nThe Places SDK for iOS sample app is available as a\n[download archive](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/archive/main.zip)\nfrom [GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps)\nFollow these steps to install and try the Places SDK for iOS sample app.\n\n1. [Download\n the code sample archive](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/archive/master.zip) from [GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/master/GooglePlaces) and unpack the archive.\n2. Open a terminal window, navigate to the directory where you expanded the sample files, and\n drill down into the GooglePlaces directory:\n\n ### Swift\n\n cd maps-sdk-for-ios-samples-master/GooglePlaces-Swift\n pod install\n open GooglePlacesDemos.xcworkspace\n\n ### Objective-C\n\n cd maps-sdk-for-ios-samples-master/GooglePlaces\n pod install\n open GooglePlacesDemos.xcworkspace\n\n3. Enable the [Places SDK for iOS](https://console.cloud.google.com/flows/enableapi?apiid=placesios,maps_ios_backend&keyType=CLIENT_SIDE_IOS&reusekey=true) for your Google Cloud console project.\n4. [Get an API key](/maps/documentation/places/ios-sdk/get-api-key) from your project with the [Places API and/or Places API (New) enabled](/maps/documentation/places/ios-sdk/cloud-setup#enabling-apis).\n5. Edit the `SDKDemoAPIKey` file and paste your API key into the appropriate constant. For example: \n\n ### Swift\n\n ```swift\n let placesAPIKey = \"YOUR_API_KEY\"\n ```\n\n ### Objective-C\n\n ```objective-c\n static NSString *const kAPIKey = @\"YOUR_API_KEY\";\n ```\n6. If Xcode prompts you to unlock the `SDKDemoAPIKey` file for editing, choose **Unlock**.\n7. If present, remove the following line, because it's used to register the issue: \n\n ### Swift\n\n ```swift\n #error (Register for API Key and insert here. Then delete this line.)\n ```\n\n ### Objective-C\n\n ```objective-c\n #error Register your API key and insert here, then delete this line.\n ```\n8. [Build the app](https://developer.apple.com/documentation/xcode/building-and-running-an-app).\n9. If the build fails or the app crashes with an error about your API key when you first run it, make sure that you have provided the keys required in the `SDKDemoAPIKey` file.\n10. If you are running the *GooglePlaces* samples, the iOS simulator window will show a list of **Places Demos**.\n11. If prompted to allow **GooglePlacesDemos** to access your location, choose **Allow**.\n12. The sample you chose is now ready to run."]]