Type Method

unarchivedObjectOfClass:fromData:error:

Decodes a previously-archived object graph, that returns the root object as the specified type.

Declaration

+ (id)unarchivedObjectOfClass:(Class)cls fromData:(NSData *)data error:(NSError * _Nullable *)error;

Parameters

cls

The expected class of the root object.

data

An object graph previously encoded by NSKeyedArchiver.

error

If the return value is nil, an NSError indicating why the unarchive operation failed.

Return Value

The decoded root of the object graph, or nil if an error occurred.

Discussion

This method produces an error if data does not contain valid keyed data.

See Also

Unarchiving Data

+ unarchivedObjectOfClasses:fromData:error:

Decodes a previously-archived object graph, returning the root object as one of the specified classes.

requiresSecureCoding

Indicates whether the receiver requires all unarchived classes to conform to NSSecureCoding.

+ unarchiveObjectWithData:

Decodes and returns the object graph previously encoded by NSKeyedArchiver and stored in a given NSData object.

Deprecated
+ unarchiveTopLevelObjectWithData:error:

Decodes a previously-archived object graph, returning the root object.

Deprecated
+ unarchiveObjectWithFile:

Decodes and returns the object graph previously encoded by NSKeyedArchiver written to the file at a given path.

Deprecated