using System; namespace UnityEngine.XR.ARKit { /// /// Error codes related to the /// [ARKit Framework](https://developer.apple.com/documentation/arkit?language=objc), /// like . /// /// /// These values correspond to /// [ARKit's ARErrorCodes](https://developer.apple.com/documentation/arkit/arerrorcode?language=objc). /// /// public enum ARKitErrorCode : long { /// /// Unsupported configuration. /// UnsupportedConfiguration = 100, /// /// A sensor required to run the session is not available. /// SensorUnavailable = 101, /// /// A sensor failed to provide the required input. /// SensorFailed = 102, /// /// App does not have permission to use the camera. The end-user can change this in the app's settings. /// CameraUnauthorized = 103, /// /// App does not have permission to use the microphone. The user can change this in the settings. /// MicrophoneUnauthorized = 104, /// /// App does not have permission to use the location data of the device. The user can change this in the settings. /// LocationUnauthorized = 105, /// /// World tracking has encountered a fatal error. /// WorldTrackingFailed = 200, /// /// Geo tracking is not available at this location. /// GeoTrackingNotAvailableAtLocation = 201, /// /// Geo tracking has encountered a runtime error. /// GeoTrackingFailed = 202, /// /// Invalid reference image /// InvalidReferenceImage = 300, /// /// Invalid reference object. /// InvalidReferenceObject = 301, /// /// Invalid world map. /// InvalidWorldMap = 302, /// /// Invalid configuration. /// InvalidConfiguration = 303, /// /// Invalid collaboration data. /// InvalidCollaborationData = 304, /// /// Insufficient features. /// InsufficientFeatures = 400, /// /// Object merge failed. /// ObjectMergeFailed = 401, /// /// Unable to read or write to file. /// FileIOFailed = 500, /// /// Generic request failure. /// RequestFailed = 501, } /// /// Extensions to the object. /// public static partial class NSErrorExtensions { /// /// Converts an to an by casting its /// to an . /// /// The being extended. /// Returns the as an . /// Thrown if 's /// is not . /// public static ARKitErrorCode AsARKitErrorCode(this NSError error) { if (error.ToErrorDomain() != NSErrorDomain.ARKit) throw new InvalidCastException($"{nameof(error)} is not an {nameof(NSErrorDomain.ARKit)} error"); return (ARKitErrorCode)error.code; } } }