---
title: Setting up access to a reference accessory file
framework: visionOS
role: article
role_heading: Article
path: visionos/setting-up-access-to-a-reference-accessory-file
---

# Setting up access to a reference accessory file

Track a generic spatial accessory by helping ARKit find the device’s reference accessory file.

## Overview

Overview To track a generic spatial accessory, your app needs a .referenceaccessory file that describes the device’s physical characteristics. ARKit uses the metadata in this file to recognize and track the device in physical space. Manufacturers create .referenceaccessory files by training an accessory tracker model in Create ML. For more information on creating a reference accessory file, see Preparing spatial accessories for tracking in your visionOS app. When your app initializes an Accessory from a connected GCSpatialAccessory, ARKit locates the corresponding .referenceaccessory file using a Uniform Type Identifier (UTI) registered with the system. If ARKit can’t find a matching file, initialization fails. For more information on Uniform Type Identifiers, see Defining file and data types for your app. This article covers the two ways to make a .referenceaccessory file available to your app: bundle the file with your app, or rely on ARKit to read it from the accessory manufacturer’s app when that app is also installed on the device. Bundle the reference accessory file Make sure you have the .referenceaccessory file for the generic spatial accessory you want to track. If you’re not the manufacturer, check with the device manufacturer to see whether they provide one. If they don’t, your app can instead rely on the manufacturer’s app to supply the file at runtime. For details, see Rely on the manufacturer’s app. To bundle the .referenceaccessory file, drag it into your Xcode project and select the checkbox next to your app target in the dialog that appears. After bundling, declare the file type in your app’s Info.plist file. You can do this in Xcode’s property list editor or by editing the source directly. To use the property list editor: In the Project navigator, select your app’s Info.plist file. Hover over a row in the Information Property List and click the + button that appears. If you’re the accessory manufacturer, choose “Exported Type Identifiers” from the dropdown. An exported declaration registers the type system-wide, so any other app installed on the device can also use the file as long as your app is present. If you’re not the accessory manufacturer, choose “Imported Type Identifiers” instead. An imported declaration tells the system that your app depends on the type but doesn’t own it. If more than one app declares an imported type for the same identifier, the system picks one of them. If your app includes an imported declaration and the manufacturer’s app, with a matching exported declaration, is also installed, ARKit always gives the exported declaration precedence. Expand the new entry’s “Item 0” and fill in the fields described below. If you prefer editing Info.plist file’s source, use the exported declaration if you’re the manufacturer, or the imported declaration if you’re not: Rely on the manufacturer’s app If the manufacturer doesn’t make their .referenceaccessory file available for bundling, your app can instead rely on ARKit to find the file in the manufacturer’s app when that app is installed on the device. Your app doesn’t need any configuration changes for this path; just ensure your app handles initialization failures gracefully. When init(device:) throws, display an error with a button that helps the person install the manufacturer’s app. do {     let trackedAccessory = try await Accessory(device: accessory)     // Use the tracked accessory. } catch {     logger.error("Failed to create accessory: \(error)")     // Prompt the person to install the manufacturer's app. } For more information on prompting people to install another app, see SKOverlay and appStoreOverlay(isPresented:configuration:).

## See Also

### Working with reference accessory files

- [Preparing spatial accessories for tracking in your visionOS app](arkit/preparing-spatial-accessories-for-tracking-in-your-visionos-app.md)
