// Thresholds for 'good enough' accuracy. These can be tuned for the// application. We use both 'low'// and 'high' values here to avoid flickering state changes.staticconstCLLocationAccuracykHorizontalAccuracyLowThreshold=10;staticconstCLLocationAccuracykHorizontalAccuracyHighThreshold=20;staticconstCLLocationDirectionAccuracykHeadingAccuracyLowThreshold=15;staticconstCLLocationDirectionAccuracykHeadingAccuracyHighThreshold=25;
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThis quickstart provides a guide on running a sample app in Xcode that demonstrates Google's ARCore Geospatial API.\u003c/p\u003e\n"],["\u003cp\u003eBefore running the sample app, ensure you have Xcode 13.0+, Cocoapods 1.4.0+ (if using), and an ARKit-compatible device with iOS 12.0+ installed.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need to set up a Google Cloud Project and obtain an API key for authorization to use the Geospatial API.\u003c/p\u003e\n"],["\u003cp\u003eThe sample app demonstrates how to place an anchor at your device's location using the Geospatial transform, which relies on VPS and GPS data for accurate positioning.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal performance, use the app outdoors in daylight with a good internet connection in a VPS-supported area; accuracy thresholds can be adjusted within the app if needed.\u003c/p\u003e\n"]]],[],null,["# Geospatial quickstart for iOS\n\nThis quickstart for the ARCore Geospatial API shows you how to run a sample app\nin Xcode that demonstrates the Geospatial API.\n\nFor a guide to developing your own app with the Geospatial API, see the\n[Geospatial developer guide for iOS](/ar/develop/ios/geospatial/developer-guide).\n\nSee the\n[Introduction to the ARCore Geospatial API](/ar/develop/geospatial) for more\ninformation about the Geospatial API.\n\nIf you're new to developing with ARCore, see [Getting started](/ar/develop/getting-started).\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\nSet up the sample app\n---------------------\n\nThe **GeospatialExample** project included with the ARCore SDK for iOS\ndescribes code that calls the Geospatial API.\n\n1. Clone or download the\n [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. Navigate to the **arcore-ios-sdk-master/Examples** folder.\n\n4. Open the **Examples** folder, select the **GeospatialExample** folder, and\n click **Open**.\n\n### Set up a Google Cloud Project\n\nBefore using the Visual Positioning System (VPS) in your app, you must first\nenable the [**ARCore API**](/ar/develop/authorization?platform=ios)\nin a new or existing Google Cloud project. Though the Geospatial API works with\nboth Keyless and API Key authorization, For this quickstart guide, use the API\nKey method.\n\n### Set up authorization\n\nTo make Geospatial API calls to the VPS, the sample app needs authorization, and\nmay use an unrestricted API key. If you use a restricted API key, you must also\nprovide a bundle ID to associate with the API key.\n\n1. In XCode, in the **GeospatialExample** sample app, open the **ViewController.m**\n file and search for **your-api-key**.\n\n2. Add your API key to the `GARSession`: paste the API key you copied from a\n previous step over the text, **your-api-key** (leave the quotes), as\n shown:\n\n self.garSession = [GARSession sessionWithAPIKey:@\"your-api-key\"\n bundleIdentifier:nil\n error:&error];\n\n### Set up the ARCore SDK\n\nThe **GeospatialExample** app ships with a `Podfile` preconfigured with the\nARCore SDK and iOS versions that you need. To install these dependencies, open a\nTerminal window and run `pod install` from the folder where the Xcode project\nexists.\n\nThis generates an `.xcworkspace` file that you'll use later to build and run the\napp.\n\nBuild and run the sample app\n----------------------------\n\n1. In Xcode, select the **GeospatialExample** workspace file, and click\n **Signing \\& Capabilities**.\n\n2. Check the box, **Automatically manage signing**.\n\n3. In the **Team** field, enter a team name.\n\n You may use the default **Bundle Identifier** to run the app from Xcode, but\n you must change it if you use the GeospatialExample as a stub for your own\n app in production.\n4. Connect your device to run the sample app.\n\n5. Build and run the **GeospatialExample** app from the `.xcworkspace` file to\n launch it on your device.\n\n To avoid build errors, make sure you are building from the `.xcworkspace`\n file and not the `.xcodeproj` file.\n\nYou should be able to see a camera view, along with debug information describing\nthe current Geospatial transform of your device. As you scan the environment\naround you, notice the positioning accuracy confidence values may change as you\nmove around, if you're in an area supported by VPS localisation.\n\nWhen ARCore is confident in your device's location and heading, you can place an\nAnchor at your current location using the Geospatial transform.\n\nThe positioning accuracy may be too low if VPS information is unavailable. The\napp must be connected to the internet, and the location must be known to the VPS.\nFor best results, run the sample app outside (not indoors) during daylight hours.\n\nAlso, if you are in an area that does not support VPS, or if GPS signals aren't\nsufficient, you may need to adjust the confidence thresholds in the app in order\nto place an anchor.\n\nTo adjust the thresholds:\n\n1. In Xcode, open the **ViewController.m** file and browse to the following\n section:\n\n // Thresholds for 'good enough' accuracy. These can be tuned for the\n // application. We use both 'low'\n // and 'high' values here to avoid flickering state changes.\n static const CLLocationAccuracy kHorizontalAccuracyLowThreshold = 10;\n static const CLLocationAccuracy kHorizontalAccuracyHighThreshold = 20;\n static const CLLocationDirectionAccuracy kHeadingAccuracyLowThreshold = 15;\n static const CLLocationDirectionAccuracy kHeadingAccuracyHighThreshold = 25;\n\n2. Adjust these values as needed. The higher the value, the *lower* the accuracy.\n\n Lowering the accuracy allows the app greater *latitude* in placing an anchor.\n See\n [Adjust for transform accuracy](/ar/develop/ios/geospatial/developer-guide#adjust-for-transform-accuracy)\n for more information.\n\nNext steps\n----------\n\nReview the\n[Geospatial developer guide for iOS](/ar/develop/ios/geospatial/developer-guide)\nand get started building with the Geospatial API."]]