Instance Method


Informs the delegate that object is about to be encoded.


- (id)archiver:(NSKeyedArchiver *)archiver willEncodeObject:(id)object;



The archiver that sent the message.


The object that is about to be encoded. This value is never nil.

Return Value

Either object or a different object to be encoded in its stead. The delegate can also modify the coder state. If the delegate returns nil, nil is encoded.


This method is called after the original object may have replaced itself with replacementObjectForKeyedArchiver::.

This method is called whether or not the object is being encoded conditionally.

This method is not called for an object once a replacement mapping has been set up for that object (either explicitly, or because the object has previously been encoded). This method is also not called when nil is about to be encoded.

See Also

Encoding Data and Objects

- archiver:didEncodeObject:

Informs the delegate that a given object has been encoded.

- archiverDidFinish:

Notifies the delegate that encoding has finished.

- archiverWillFinish:

Notifies the delegate that encoding is about to finish.

- archiver:willReplaceObject:withObject:

Informs the delegate that one given object is being substituted for another given object.