docs.unity3d.com
    Show / Hide Table of Contents

    Struct NSError

    Information about an error condition including a domain, a domain-specific error code, and application-specific information.

    Namespace: UnityEngine.XR.ARKit
    Syntax
    public struct NSError : INSObject, IEquatable<NSError>
    Remarks

    This is a wrapper for Objective-C's NSError object.

    Properties

    code

    (Read Only) The error code associated with this NSError.

    Declaration
    public readonly long code { get; }
    Property Value
    Type Description
    Int64
    Remarks

    Error codes are domain-specific. See ToErrorDomain() and domain.

    See Apple's documentation for more information.

    domain

    (Read Only) A string containing the error domain.

    Declaration
    public readonly string domain { get; }
    Property Value
    Type Description
    String
    Remarks

    See Apple's documentation for more information.

    See Also
    ToErrorDomain()

    isNull

    (Read Only) Whether the underlying native pointer is null.

    Declaration
    public readonly bool isNull { get; }
    Property Value
    Type Description
    Boolean

    localizedDescription

    (Read Only) A string containing the localized description of the error.

    Declaration
    public readonly string localizedDescription { get; }
    Property Value
    Type Description
    String
    Remarks

    See Apple's documentation for more information.

    localizedFailureReason

    (Read Only) A string containing the localized explanation of the reason for the error.

    Declaration
    public readonly string localizedFailureReason { get; }
    Property Value
    Type Description
    String
    Remarks

    See Apple's documentation for more information.

    localizedRecoverySuggestion

    (Read Only) A string containing the localized recovery suggestion for the error.

    Declaration
    public readonly string localizedRecoverySuggestion { get; }
    Property Value
    Type Description
    String
    Remarks

    See Apple's documentation for more information.

    Methods

    AsIntPtr()

    Gets the underlying Objective-C pointer.

    Declaration
    public IntPtr AsIntPtr()
    Returns
    Type Description
    IntPtr

    Returns the underlying Objective-C pointer.

    Equals(Object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The Object to test.

    Returns
    Type Description
    Boolean

    Returns true if obj is an NSError and is considered equal using Equals(NSError). Returns false otherwise.

    Overrides
    ValueType.Equals(Object)

    Equals(NSError)

    Determines whether other is equal to this one as determined by isEqual:

    Declaration
    public bool Equals(NSError other)
    Parameters
    Type Name Description
    NSError other

    The other NSError to test for equality.

    Returns
    Type Description
    Boolean

    Returns true if other is considered equal using isEqual:. Returns false otherwise.

    GetHashCode()

    Generates a hash code for this NSError.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Returns a hash code for this NSError.

    Overrides
    ValueType.GetHashCode()
    Remarks

    The hash code is generated using NSObject's hash property.

    ToErrorDomain()

    The domain as an NSErrorDomain enum.

    Declaration
    public NSErrorDomain ToErrorDomain()
    Returns
    Type Description
    NSErrorDomain

    Returns the NSErrorDomain of this NSError, or Unknown if the error domain could not be determined.

    Remarks

    This method tries to determine the error domain without generating any managed strings. If the error domain is Unknown, you may still be able to get additional information from its string representation (domain).

    ToString()

    Generates a string representation of this NSError.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Returns a string representation of this NSError.

    Overrides
    ValueType.ToString()
    Remarks

    This method uses NSObject's description property to generate the string.

    Operators

    Equality(NSError, NSError)

    Tests whether the underlying pointers for two NSError objects are the same.

    Declaration
    public static bool operator ==(NSError lhs, NSError rhs)
    Parameters
    Type Name Description
    NSError lhs

    The NSError to compare with rhs.

    NSError rhs

    The NSError to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns true if the underlying pointers of lhs and rhs are the same. Returns false otherwise.

    Remarks

    This only tests whether two NSErrors point to the same object in memory. Two different NSErrors could still be considered equal. See Equals(NSError).

    Inequality(NSError, NSError)

    Tests whether the underlying pointers for two NSError objects are different.

    Declaration
    public static bool operator !=(NSError lhs, NSError rhs)
    Parameters
    Type Name Description
    NSError lhs

    The NSError to compare with rhs.

    NSError rhs

    The NSError to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns true if the underlying pointers of lhs and rhs are different. Returns false otherwise.

    Remarks

    This only tests whether two NSErrors point to different objects in memory. Two different NSErrors could still be considered equal. See Equals(NSError).

    Extension Methods

    NSErrorExtensions.AsARKitErrorCode(NSError)
    NSErrorExtensions.AsCoreLocationErrorCode(NSError)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023