Durrr... of course there was something fundamental I had completely forgotten about how Core Data stores complex objects. Hope this helps some other newbie out there who's as clueless as I was. Sigh.
Docs: Transformable attributes
So here's the really simple solution to my question above about encoding a CLPlacemark in core data:
- change type of attribute in Core Data model to be
Transformable
- In the header for the NSManagedObject subclass, remember to change the type of the
NSManagedObject's
property from NSData to whatever class you're trying to encode, in my caseCLPlacemark
Then just use the attribute as you would a normal object, e.g.
self.placemark = place.placemark
No mucking around with NSKeyedArchiver
s needed.