I have a core data entity with a placemark data attribute in which I'm trying to store a CLPlacemark object.
@interface ZJPlace : NSManagedObject
...
@property (nonatomic, retain) NSData * placemark;
I'm encoding the object like this:
place.placemark = [NSKeyedArchiver archivedDataWithRootObject:self.placemark];
and decoding like this:
self.placemark = [NSKeyedUnarchiver unarchiveObjectWithData:place.placemark];
On decoding, I'm not getting an error or nil back - it just looks like an empty CLPlacemark object (self.placemark
's class is CLPlaceMark
but description
doesn't print anything to the log.)
I can see there's data saved in the place.placemark
core data attribute but it's not getting decoded back to a proper object. It's basically the same problem as in this question: Trouble decoding with NSKeyedUnarchiver which went unanswered.
Is there something fundamental I'm missing here about how to use NSKeyedArchiver and CoreData together? Thanks in advance for any hints...