Protocol

ARSessionObserver

Methods you can implement to respond to changes in the state of an AR session.

Overview

This protocol defines optional methods common to the ARSessionDelegate, ARSCNViewDelegate, and ARSKViewDelegate protocols. You can implement this protocol's methods when adopting one of those protocols.

Topics

Responding to Tracking Quality Changes

func session(ARSession, cameraDidChangeTrackingState: ARCamera)

Informs the delegate of changes to the quality of ARKit's device position tracking.

Handling Interruptions

func sessionWasInterrupted(ARSession)

Tells the delegate that the session has temporarily stopped processing frames and tracking device position.

func sessionInterruptionEnded(ARSession)

Tells the delegate that the session has resumed processing frames and tracking device position.

func sessionShouldAttemptRelocalization(ARSession) -> Bool

Asks the delegate whether to attempt recovery of world-tracking state after an interruption.

Receiving Audio Data

func session(ARSession, didOutputAudioSampleBuffer: CMSampleBuffer)

Tells the delegate that a new sample buffer of recorded audio is available.

Handling Session Failure

func session(ARSession, didFailWithError: Error)

Tells the delegate that the session has stopped running due to an error.

let ARErrorDomain: String

The error domain for NSError objects produced by an AR session.

enum ARError.Code

Error codes for NSError objects produced by an AR session.

struct ARError

The type for errors thrown by ARKit methods.

Relationships

Inherits From

See Also

Responding to AR Updates

var delegate: ARSessionDelegate?

An object you provide to receive captured video images and tracking information, or to respond to changes in session status.

var delegateQueue: DispatchQueue?

The dispatch queue through which the session calls your delegate methods.

protocol ARSessionDelegate

Methods you can implement to receive captured video frame images and tracking state from an AR session.