تم إيقاف نقطة النهاية القديمة لسحابة ARCore Cloud Anchor API نهائيًا ولن تعود متاحة بعد 31 آب (أغسطس) 2023. إذا كان تطبيقك يستخدم واجهة برمجة التطبيقات هذه، عليك تحديثها لاستخدام نقطة نهاية السحابة الإلكترونية ARCore API الجديدة في أقرب وقت ممكن.
التشغيل السريع لـ Cloud Anchors في نظام التشغيل iOS
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توفّر واجهة برمجة التطبيقات ARCore Cloud Anchor API أو خدمة ARCore Cloud Anchor إمكانات ربط السحابة الإلكترونية لتطبيقاتك على أجهزة iOS، ما يتيح
للمستخدمين على أجهزة iOS وAndroid مشاركة تجارب الواقع المعزّز.
يوضّح لك هذا الدليل كيفية تنفيذ ما يلي:
إعداد بيئة التطوير للعمل مع ميزة "تثبيتات السحابة"
Cocoapods 1.4.0 أو إصدار أحدث في حال استخدام Cocoapods
جهاز Apple متوافق مع ARKit يعمل بالإصدار 12.0 من نظام التشغيل iOS أو إصدار أحدث
(يجب أن يكون هدف النشر هو الإصدار 12.0 من نظام التشغيل iOS أو إصدار أحدث)
استخدام "عناصر الربط في السحابة الإلكترونية"
تستخدِم الخطوات التالية نموذج تطبيق "نقاط الربط في السحابة الإلكترونية" لعرض المهام
المهمة لضبط إعدادات تطبيق متوافق مع ميزة "نقاط الربط في السحابة الإلكترونية" من ARCore وإنشائه.
الحصول على نموذج تطبيق "تثبيتات السحابة الإلكترونية"
تمرير ARFrames
إلى GARSession في طريقة session:didUpdateFrame:
إعداد مشاركة معرّف Cloud Anchor
يستخدم نموذج تطبيق "محطات الربط في السحابة الإلكترونية" Firebase لمشاركة أرقام تعريف "محطات الربط في السحابة الإلكترونية" بين
الأجهزة. يمكنك استخدام حلّ مختلف في تطبيقاتك.
يتم شحن تطبيق CloudAnchorExample مع Podfile تم ضبطه مسبقًا باستخدام
حزمة تطوير البرامج (SDK) لـ ARCore وإصدارات iOS التي ستحتاج إليها. لتثبيت هذه التبعيات:
افتح نافذة Terminal (وحدة التحكّم في المحطة الطرفية) وشغِّل pod update من المجلد الذي يتوفّر فيه
مشروع Xcode.
يؤدي ذلك إلى إنشاء ملف .xcworkspace ستستخدمه لاحقًا لإنشاء التطبيق
وتشغيله.
لتجنُّب أخطاء التصميم، تأكَّد من أنّك تُنشئ التطبيق من ملف .xcworkspace
وليس من ملف .xcodeproj.
تغيير رقم تعريف حزمة التطبيق
في Xcode، غيِّر معرّف حِزمة التطبيق حتى تتمكّن من توقيع التطبيق مع فريقك.
إنشاء التطبيق وتشغيله
وصِّل جهازك وافتح التطبيق في Xcode.
(اختياري) إذا كنت بصدد إنشاء نموذج التطبيق وتشغيله، اطّلِع على القسم التالي
لمعرفة تفاصيل عن استخدام التطبيق لاستضافة "محطات Cloud Anchors" وحلّها.
تجربة التطبيق النموذجي
أنشئ تطبيق النموذج وشغِّله من ملف .xcworkspace لبدء استخدامه على جهازك.
امنح التطبيق أذونات الوصول إلى الكاميرا إذا طُلب منك ذلك. سيبدأ ARKit بعد ذلك في رصد الطائرات أمام الكاميرا.
انقر على HOST للدخول إلى وضع الاستضافة. يتم إنشاء رمز غرفة لمشاركة نقاط الربط المستضافة ويظهر على شاشتك.
انقر على طائرة لبدء استضافة عنصر تثبيت السحابة الإلكترونية هناك.
يضع التطبيق عنصر Andy Android على المستوى ويربطه بنقطة تثبيت.
يتم إرسال طلب مضيف إلى نقطة نهاية السحابة الإلكترونية لواجهة برمجة التطبيقات ARCore API. يتضمّن طلب المضيف
بيانات تمثّل موضع العنصر الأساسي بالنسبة إلى
العناصر المرئية القريبة منه.
بعد استضافة العنصر الأساسي، يحصل على معرّف يُستخدَم لتحديد مثيل العنصر الأساسي في السحابة.
انقر على RESOLVE وأدخِل رمز غرفة للوصول إلى علامات Cloud Anchors التي سبق أن تم استضافتها لهذه الغرفة باستخدام الجهاز نفسه أو جهاز مختلف.
يتم إرسال طلب حلّ إلى نقطة نهاية ARCore API في السحابة الإلكترونية.
يتضمّن طلب المعالجة معرّف عنصر التثبيت في السحابة الإلكترونية. إذا تطابق المعرّف مع
مرساة مستضافة ونجحت عملية الأقلمة، يعرض الخادم
تحويل المرساة في إحداثياتك المحلية.
يستخدم نموذج التطبيق عملية التحويل لإضافة العنصر الأساسي إلى المشهد و
عرض الأجسام الافتراضية المرتبطة به.
إضافة حزمة تطوير البرامج (SDK) لتطبيق ARCore إلى تطبيقاتك
في تطبيقاتك، عليك تحديث Podfile لتضمين
حزمة تطوير البرامج (SDK) لـ ARCore وإصدارات iOS المتوافقة. ولإجراء ذلك:
أضِف platform وpod التاليَين إلى Podfile
المشروع:
platform :ios, '11.0'
pod 'ARCore/CloudAnchors', '~> 1.50.0'
افتح نافذة Terminal (وحدة التحكّم في المحطة الطرفية) وشغِّل pod update من المجلد الذي يقع فيه
مشروع Xcode.
يؤدي ذلك إلى إنشاء ملف .xcworkspace الذي تستخدمه لإنشاء التطبيق
وتشغيله.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe ARCore Cloud Anchor API enables shared AR experiences between iOS and Android devices by allowing users to host and resolve cloud anchors.\u003c/p\u003e\n"],["\u003cp\u003eTo use Cloud Anchors, you need Xcode 13.0+, Cocoapods 1.4.0+ (if using), an ARKit-compatible device running iOS 12.0+, and the ARCore SDK for iOS.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Anchors sample app demonstrates key tasks like session setup, Cloud Anchor ID sharing via Firebase, and hosting/resolving anchors.\u003c/p\u003e\n"],["\u003cp\u003eYou can add the ARCore SDK to your own iOS apps by updating your Podfile and running \u003ccode\u003epod update\u003c/code\u003e to install the necessary dependencies.\u003c/p\u003e\n"],["\u003cp\u003ePersistent Cloud Anchors can be created with a time-to-live up to 365 days, allowing for longer-lasting shared AR experiences.\u003c/p\u003e\n"]]],[],null,["# Quickstart for Cloud Anchors in iOS\n\nThe **ARCore Cloud Anchor API** , or **ARCore Cloud Anchor service**, provides cloud anchor capabilities for your iOS apps, making it\npossible for users on both iOS and Android devices to share AR experiences.\n\nThis guide shows you how to:\n\n- Set up your development environment to work with Cloud Anchors\n- Try out hosting and resolving anchors in a sample app\n\nPrerequisites\n-------------\n\n- [Xcode](https://developer.apple.com/xcode/) version 13.0 or later\n- [Cocoapods](https://cocoapods.org/) 1.4.0 or later if using Cocoapods\n- An ARKit-compatible Apple device running iOS 12.0 or later (deployment target of iOS 12.0 or later required)\n\n| **Note:** Beginning with ARCore 1.12, all ARKit-compatible devices are supported.\n\nUsing Cloud Anchors\n-------------------\n\nThe following steps use the Cloud Anchors sample app to show you the critical\ntasks for configuring and building an app that supports ARCore Cloud Anchors.\n\n### Get the Cloud Anchors sample app\n\n1. Clone or download the [ARCore SDK for iOS from GitHub](https://github.com/google-ar/arcore-ios-sdk/releases)\n to obtain the sample app code.\n\n2. Open a Terminal or Finder window and navigate to the folder where you cloned\n or downloaded the SDK.\n\n3. You can find the sample app code in \n\n `/arcore-ios-sdk-master/Examples/CloudAnchorExample`.\n\n The [persistent cloud anchors](#persistent-cloud-anchors) sample app code is\n in \n\n `/arcore-ios-sdk-master/Examples/PersistentCloudAnchorExample`.\n\n### Session setup\n\nThe sample app performs the following important tasks as part of setting up the\nsession:\n\n- Creating a [`GARSession`](/ar/reference/ios/interface_g_a_r_session)\n- Creating an [`ARSession`](https://developer.apple.com/documentation/arkit/arsession) and running it\n- Setting an [`ARSessionDelegate`](https://developer.apple.com/documentation/arkit/arsession/2865614-delegate).\n- Passing [`ARFrame`s](https://developer.apple.com/documentation/arkit/arframe) to the `GARSession` in the `session:didUpdateFrame:` method.\n\n### Set up Cloud Anchor ID sharing\n\nThe Cloud Anchors sample app uses Firebase for sharing Cloud Anchor IDs between\ndevices. You can use a different solution in your own apps.\n\nTo set up Firebase database in the sample app:\n\n1. Follow the Firebase instructions for [adding Firebase to your app](https://firebase.google.com/docs/ios/setup).\n2. Download the `GoogleService-Info.plist` file generated as part of adding Firebase to your app.\n3. Enable Firebase storage for the sample:\n - Go to the **Firebase console** and select the project you set up for the sample app.\n - Select the **Database** panel.\n - On the **Realtime Database** option, click **Get Started**.\n - The **Security rules for Realtime Database** menu opens.\n - For purposes of running the sample, select **Start in test mode**.\n - Note that if you are using Firebase for an app that you plan to publish, you should use more restrictive security rules.\n4. In Xcode, add the `GoogleService-Info.plist` file to your app, next to `Info.plist`.\n\n### Set up the ARCore API\n\nTo use Cloud Anchors, you must first set up the\n[**ARCore API**](/ar/develop/authorization?platform=ios) for your application.\n\n### Run pod update\n\nThe **CloudAnchorExample** app ships with a `Podfile` preconfigured with the\nARCore SDK and iOS versions that you'll need. To install these dependencies:\n\n1. Open a Terminal window and run `pod update` from the folder where the Xcode project exists. \n This generates an `.xcworkspace` file that you'll use later to build and run the app.\n\nSee [Add the ARCore SDK to your app](/ar/develop/ios/cloud-anchors-quickstart-ios#add_the_arcore_sdk_to_your_apps)\nfor details on configuring the `Podfile` in your own apps.\n\n1. Open the `.xcworkspace` file for the project in Xcode.\n\n To avoid build errors, make sure you are building from the `.xcworkspace`\n file and not the `.xcodeproj` file.\n\n### Change the app bundle ID\n\nIn Xcode, change the app's bundle ID so that you can sign the app with your team.\n\n### Build and run the app\n\n1. Connect your device and launch the app in Xcode.\n\n2. (Optional) If you are building and running the sample app, see the following\n section for details on using the app to host and resolve Cloud Anchors.\n\n### Try out the sample app\n\n1. Build and run the sample app from the `.xcworkspace` file to launch\n it on your device.\n\n2. If prompted, grant camera permissions to the app. ARKit then\n starts detecting planes in front of your camera.\n\n3. Tap **HOST** to enter hosting mode. A room code for sharing hosted anchors\n is generated and appears on your screen.\n\n4. Tap a plane to start hosting a cloud anchor there.\n\n - The app places an Andy Android object on the plane and attaches an anchor to it.\n - A host request is sent to the ARCore API cloud endpoint. The host request includes data representing the anchor's position relative to the visual features near it.\n - Once the anchor is hosted, it gets an ID that is used for resolving cloud anchors in this space.\n5. Tap **RESOLVE** and enter a room code to access previously\n hosted Cloud Anchors for this room, using the same or a different device. \n\n - A resolve request is sent to the ARCore API cloud endpoint.\n - The resolve request includes a cloud anchor ID. If the ID matches a hosted anchor and localization is successful, the server returns the transform of the anchor in your local coordinates.\n - The sample app uses the transform to add the anchor to your scene and render virtual objects attached to it.\n\nAdd the ARCore SDK to your apps\n-------------------------------\n\nIn your own apps, you'll need to update your `Podfile` to include the\nARCore SDK and supported iOS versioning. To do this:\n\n1. Add the following `platform` and `pod` to your\n project's `Podfile`:\n\n platform :ios, '11.0'\n pod 'ARCore/CloudAnchors', '~\u003e 1.50.0'\n\n| **Note:** To ensure that your project includes the correct ARCore version, **specify\n| all three of the `ARCore` version digits** in your `pod`. For example, use `1.12.0` instead of `1.12`.\n\n1. Open a Terminal window and run `pod update` from the folder where your Xcode project exists. \n This generates an `.xcworkspace` file that you use to build and run the app.\n\nPersistent cloud anchors\n------------------------\n\nAs described in [Host a Cloud Anchor with persistence](https://developers.google.com/ar/develop/ios/cloud-anchors/developer-guide#host-with-persistence),\nyou can give the cloud anchor a time-to-live up to 365 days. Sample code for\nusing persistent cloud anchors is available in the `/arcore-ios-sdk-master/Examples/PersistentCloudAnchorExample`\ndirectory in the [ARCore SDK for iOS from GitHub](https://github.com/google-ar/arcore-ios-sdk/releases).\n\nNext steps\n----------\n\n- See the [Cloud Anchors Developer Guide for iOS](/ar/develop/ios/cloud-anchors/cloud-anchors-developer-guide-ios)\n to explore the sample app code and learn more about working with Cloud Anchors\n in your own apps.\n\n- Review details in the [ARCore iOS API Reference](/ar/reference/ios)."]]