ARKitSession
The main entry point for receiving data from ARKit.
Declaration
final class ARKitSessionOverview
Sessions in ARKit require either implicit or explicit authorization. To explicitly ask for permission for a particular kind of data and choose when a person is prompted for that permission, call requestAuthorization(for:) before run(_:).
The following shows a session that starts by requesting implicit authorization to use world sensing:
let planeData = PlaneDetectionProvider(alignments: [.horizontal, .vertical])
Task {
do {
try await self.session.run([planeData])
// Update app based on the planeData.anchorUpdates async sequence.
} catch {
print("ARKitSession error:", error)
}
}Because a PlaneDetectionProvider instance’s required authorizations include ARKitSession.AuthorizationType.worldSensing, the system asks someone using your app to permit world sensing before ARKit supplies any of that kind of data.
Topics
Starting and stopping a session
Getting authorization
requestAuthorization(for:)ARKitSession.AuthorizationTypequeryAuthorization(for:)ARKitSession.AuthorizationStatus