Struct NSError
Information about an error condition including a domain, a domain-specific error code, and application-specific information.
Inherited Members
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
isNull
(Read Only) Whether the underlying native pointer is null
. This property is deprecated. Compare
an NSError with null
instead.
Declaration
[Obsolete("Compare with null instead, e.g., error == null. (2021-02-03)")]
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 |
Overrides
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 |
Implements
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
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 might 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
Remarks
This method uses NSObject's description property to generate the string.
Operators
Equality(Nullable<NSError>, Nullable<NSError>)
Tests for equality.
Declaration
public static bool operator ==(NSError? lhs, NSError? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<NSError> | lhs | The nullable NSError to compare with |
Nullable<NSError> | rhs | The nullable NSError to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns true if any of these conditions are met:
Returns false otherwise. |
Remarks
This equality operator allows you to compare null
with an NSError to determine whether its
underlying pointer is null. This allows for a more natural comparison with the Objective-C object:
void TestForNull(NSError error)
{
// True if the native NSError object is null.
if (error == null)
{
// Do something with the error
}
}
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 |
NSError | rhs | The NSError to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |
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(Nullable<NSError>, Nullable<NSError>)
Tests for inequality.
Declaration
public static bool operator !=(NSError? lhs, NSError? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<NSError> | lhs | The nullable NSError to compare with |
Nullable<NSError> | rhs | The nullable NSError to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns the opposite of Equality(Nullable<NSError>, Nullable<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 |
NSError | rhs | The NSError to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |
Remarks
This only tests whether two NSErrors point to different objects in memory. Two different NSErrors could still be considered equal. See Equals(NSError).