In your managed object subclass you must implement the serializationObjectsToSkip
:
- (NSMutableSet*) serializationObjectsToSkip
{
NSMutableSet* objectsToSkip = [NSMutableSet new];
//Here you select objects that relate to this object and you don't want to serialise.
//Insert them into `objectsToSkip`
return objectsToSkip;
}
However, the implementation of the serialisation looks buggy (lines 80 and 93) ... (if you don't supply all objects to skip in advance)
The toDictionary
of the relatedObject
is skipped and so objects that the related objects may want to skip will not be added to the traversal history set ...
A quick fix might be to replace these lines with the full implementation of toDictionary
and merging the traversal history set and the objectsToSkip
sets returned ...
A better solution will be to change the signature of the toDictionary
method to accept the traversal history and do the set merging there and replace the above lines with toDictionary
of the related object.