Instance Method


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


- (BOOL)sessionShouldAttemptRelocalization:(ARSession *)session;



The session providing information.


ARKit can't track device position or orientation when the session has been interrupted (for example, by calling pause, switching to another app, or reaching a debugger breakpoint). The session calls this method when resuming from an interruption. If you don't implement this method or your implementation returns NO, then the ARKit world coordinate system and anchor positions likely no longer match the device's real-world environment.

If you implement this method and return YES, ARKit attempts to reconcile pre- and post-interruption world-tracking state. During this process, tracking quality is limited (with the reason value ARCamera.TrackingState.Reason.relocalizing), and hit tests and anchor placement may be less accurate. If successful, relocalization ends after a short time and the world coordinate system and anchor positions reflect their state before the interruption.

For relocalization to succeed, the device must be returned to a position and orientation near where it was when the session was interrupted. If these conditions never occur (or cannot occur; for example, if the device has moved to an entirely different environment), the session will remain in the ARCamera.TrackingState.Reason.relocalizing state indefinitely.

You can give up on relocalizing by calling the session's runWithConfiguration:options: method with the ARSessionRunOptionResetTracking option. Resetting tracking during relocalization discards all world-tracking state from before the interruption, but keeps world-tracking results obtained during the relocalization attempt.

See Also

Handling Interruptions

- sessionWasInterrupted:

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

- sessionInterruptionEnded:

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