Type Method

unarchiveTopLevelObjectWithData:error:

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

Declaration

+ (id)unarchiveTopLevelObjectWithData:(NSData *)data error:(NSError * _Nullable *)error;

Parameters

data

An object graph previously encoded by NSKeyedArchiver.

error

On output, an error encountered during decoding, or nil if no error occurred.

Return Value

The unarchived object, 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.

+ 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
+ unarchiveObjectWithFile:

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

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software