NSKeyedUnarchiverDelegate Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | NSKeyedArchiver.h |
Overview
The NSKeyedUnarchiverDelegate protocol defines the optional methods implemented by delegates of NSKeyedUnarchiver objects.
Tasks
Decoding Objects
-
– unarchiver:cannotDecodeObjectOfClassName:originalClasses: -
– unarchiver:didDecodeObject: -
– unarchiver:willReplaceObject:withObject:
Finishing Decoding
Instance Methods
unarchiver:cannotDecodeObjectOfClassName:originalClasses:
Informs the delegate that the class with a given name is not available during decoding.
Parameters
- unarchiver
An unarchiver for which the receiver is the delegate.
- name
The name of the class of an object
unarchiveris trying to decode.- classNames
An array describing the class hierarchy of the encoded object, where the first element is the class name string of the encoded object, the second element is the class name of its immediate superclass, and so on.
Return Value
The class unarchiver should use in place of the class named name.
Discussion
The delegate may, for example, load some code to introduce the class to the runtime and return the class, or substitute a different class object. If the delegate returns nil, unarchiving aborts and the method raises an NSInvalidUnarchiveOperationException.
Availability
- Available in iOS 2.0 and later.
- Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSKeyedArchiver.hunarchiver:didDecodeObject:
Informs the delegate that a given object has been decoded.
Parameters
- unarchiver
An unarchiver for which the receiver is the delegate.
- object
The object that has been decoded. object may be
nil.
Return Value
The object to use in place of object. The delegate can either return object or return a different object to replace the decoded one. If the delegate returns nil, the decoded value will be unchanged (that is, the original object will be decoded).
Discussion
This method is called after object has been sent initWithCoder: and awakeAfterUsingCoder:.
The delegate may use this method to keep track of the decoded objects.
Availability
- Available in iOS 2.0 and later.
- Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSKeyedArchiver.hunarchiver:willReplaceObject:withObject:
Informs the delegate that one object is being substituted for another.
Parameters
- unarchiver
An unarchiver for which the receiver is the delegate.
- object
An object in the archive.
- newObject
The object with which unarchiver will replace object.
Discussion
This method is called even when the delegate itself is doing, or has done, the substitution with unarchiver:didDecodeObject:.
The delegate may use this method if it is keeping track of the encoded or decoded objects.
Availability
- Available in iOS 2.0 and later.
- Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSKeyedArchiver.hunarchiverDidFinish:
Notifies the delegate that decoding has finished.
Parameters
- unarchiver
An unarchiver for which the receiver is the delegate.
Availability
- Available in iOS 2.0 and later.
- Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSKeyedArchiver.hunarchiverWillFinish:
Notifies the delegate that decoding is about to finish.
Parameters
- unarchiver
An unarchiver for which the receiver is the delegate.
Availability
- Available in iOS 2.0 and later.
- Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSKeyedArchiver.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-05-30)