Type Method

unarchivedObjectOfClasses:fromData:error:

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

Declaration

+ (id)unarchivedObjectOfClasses:(NSSet<Class> *)classes fromData:(NSData *)data error:(NSError * _Nullable *)error;

Parameters

classes

A set of classes, at least one of which the root object should conform to.

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, as an instance of one of the specified classes, or nil if an error occurred.

Discussion

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

See Also

Unarchiving Data

+ unarchivedObjectOfClass:fromData:error:

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

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