Example of using ARKit's private SPI to record and replay session sensor data
⚠️ This project is not actively maintained and due to use of private SPI may not work with newer releases of iOS. ⚠️
This project demonstrates how ARKit’s private SPI can be used to record and replay AR sessions, thus enabling a convenient development workflow and test automation.
Disclaimer: Functionality exposed and used in this project is private SPI. It’s not guaranteed to be reliable or stay available in any form in future versions of ARKit. It definitely cannot be used in production versions of apps distributed on the App Store.
Clone the repository and open ARRecorder.xcodeproj
in Xcode 10 or newer. Configure automatic codesigning by opening project settings, ARRecorder target, General, and configuring the Team setting in the Signing section.
The app starts a normal AR session once launched. Tap Record to start recording the session to a local file. Then tap Finish to complete the recording and continue a normal session. To replay a previously recorded session, tap Replay, then select the file. To stop the replay at any time, tap ╳.
During both normal, recording and replay sessions, tap anywhere to place a virtual cube in the scene at the estimated physical location that corresponds to your touch. Note that this won’t be recorded into the replay file: you can interact with the session differently during recording and replay.
To delete a recorded file, tap Replay and swipe left on a file row, then tap Delete. You can also access all session recordings using the Files app by selecting On My iPhone/iPad location, where ARRecorder’s documents container will show up. The app is also configured to allow File Sharing via iTunes.
Relevant SPI classes and methods are annotated across a few headers like ARRecordingTechnique.h and ARReplaySensorProtocol.h (please see ARKit Private API
group in Xcode project for the full list). Their signature and presumed function have been observed as of ARKit 3.0.
Note that depending on the iOS version, either ARReplaySensor
or ARReplaySensorPublic
class is used to load replays. See ARConfiguration.makeReplayConfiguration(replayURL:)
method in MainViewController.swift for an example of how that can be done.
All iOS 11.3+ devices with A9 chip or newer are supported. This includes:
The project can be modified to support a wider range of hardware by replacing session’s world tracking configuration with an orientation tracking configuration.
This work is licensed under a BSD 3-Clause License.