Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jeanlain

macrumors 68020
Original poster
Mar 14, 2009
2,430
933
I have a NSManagedObject subclass called "Folder" that has an ordered to-many relationship called "subfolders" that points to itself. Hence, a folder contains subfolders that are of the same entity. The relationship is ordered because the folders are showing in some particular order in an NSOutlineView.
The reciprocal relationship (to-one) is called "parent".
Folder also has an NSString attribute called "name".

Problem: after moving a subfolder between or within a parent folder, or after adding a new subfolder to a parent, all attributes and relationships of some (not all) other folders (in the same parent) become nil upon saving the context.
The attributes are nullified not via their setters (setName: is not called). It's as if the folder was considered deleted. But it's not.

I noticed it because some folder names would disappear from the outline view after a save.
Stranger still, when I query a folder's name after the save, the original name is (thankfully) restored.

This happens regardless of the context in which the folders are materialized (view context or background context), but this seems to happen only once per app session.

Is there a core data quirk that could explain that?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.