Struct NSError
Information about an error condition including a domain, a domain-specific error code, and application-specific information.
Implements
Inherited Members
Namespace: UnityEngine.XR.ARKit
Assembly: Unity.XR.ARKit.dll
Syntax
public struct NSError : 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 long code { get; }
Property Value
| Type | Description |
|---|---|
| long |
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 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 bool isNull { get; }
Property Value
| Type | Description |
|---|---|
| bool |
localizedDescription
(Read Only) A string containing the localized description of the error.
Declaration
public 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 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 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | Returns |
GetHashCode()
Generates a hash code for this NSError.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | 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
operator ==(NSError?, NSError?)
Tests for equality.
Declaration
public static bool operator ==(NSError? lhs, NSError? rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| NSError? | lhs | The nullable NSError to compare with |
| NSError? | rhs | The nullable NSError to compare with |
Returns
| Type | Description |
|---|---|
| bool | Returns true if any of these conditions are met:
-
|
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
}
}
operator ==(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 |
|---|---|
| bool | 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).
operator !=(NSError?, NSError?)
Tests for inequality.
Declaration
public static bool operator !=(NSError? lhs, NSError? rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| NSError? | lhs | The nullable NSError to compare with |
| NSError? | rhs | The nullable NSError to compare with |
Returns
| Type | Description |
|---|---|
| bool | Returns the opposite of operator ==(NSError?, NSError?). |
operator !=(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 |
|---|---|
| bool | 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).