setPrimitiveValue:forKey: on pg 300


Hi all,

Can anyone explain the difference between these two NSManageObject methods: setPrimitiveValue:forKey and setValue:forKey:? When would you use one over the other? What is considered a primitive value (int, char, etc.) ?

Also on page 300, for the -(void)awakeFromFetch method, why are we setting the instance’s thumbnail ivar using setPrimitiveValue:forKey: ? Could the following achieve the same result?

[self setThumbnail:tn];

Thanx in advance!


i second this question.

turns out … not using “primitive” works also…

what is the “primitive” version for?

whats wrong with leaving “primitive” out?


It would work but there would be a warning.

Warning because, it does actually invoke that method dynamically (Core Data implementation file have them synthesized dynamically)) but at the same time as per Objective C, it does;t really define that method in the interface file.