Loading and NSKeyedUnarchiver


#1

Hi,
on page 169, there is written: “You could update the user interface after the XIB file is loaded, but NSArrayController will handle it for you …”. Question: How? Within the method readFromData:ofType:error:, we call at the end the setEmployees method. After loading the data from a file, the employees array will be set to the loaded data. Since the tableView is bound to the arrays content, it will recognize the change and reload. Am I correct, or did I miss an indirection over the NSArrayController?

In this context I’D like to ask another question: When saving takes place, is a value and it’s key saved? So that, when loading takes place through newArray = [NSKeyedUnarchiver unarchiveObjectWithData:data], for every object inside the data Array, the method looks what kind of object it is, and then will call the appropriate decode methods? Those then will handle the assignment of the values to the correct variables of the object.
This is just to keep things clear in my head.

Finally: If one wants to store more than one object type in a file, would it be the best way to make an array with all objects inside to be saved and use this as the rootObject for NSKeyedArchiver?

Thanks
Phil