"NSKeyedArchiver encodeWithCoder:" method calls


#1

Hello,

I have a question about the under the hood method callchain from NSKeyedArchiver during the process of archiving:

In figure 14.2 on page 210 the possession-object receives an encodeWithCoder-message and calls the same method for his instance variables.
In the code snippet for the encodeWithCoder-method below, for every instance variable the encode: forKey:-method is called.

in figure 14.4 on page 214 this time the possession-object receives an encodeObject:forKey:-message like it was called in the code snippet encodeWithCoder-method and forwards it like outlined above.

I assume that encodeWithCoder: is a template method, within encode:forKey: is called . Is that right, that within the corresponding encode: forKey:-method besides the archivingtasks the encodeWithCoder:-method is called to traverse the whole objectgraph?
If I’m mistaken, can someone explain me the method callchain?

Thanks!