Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Core Data, transient properties and saving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data, transient properties and saving

Hi Guys,

Has anyone come across this before? I've looked online and I think I know the problem but the solution is evading me!

I have an NSManagedObject that represents a text file, the text itself is saved to a text file and the file's attributes are stored in the persistent store (much the same way Xcode works). The file has a non- optional, transient property isEdited (default is NO) that gets updated to YES when the text is edited and then set to NO when the text itself is saved to the locations specified by the file's path property. However if I want to save an individual file and then save any changes to the object graph subsequent fetches with the predicate @"isEdited == YES" does not return any other edited files.

So saving the store has turned all my file objects into faults. However as all my files are in a source list, after saving one file selecting one of the other files I know to be edited and then trying to fetch again returns the selected file. Therefore the fault seems to be fired by my tree controller and the isEdited value is correct.

In practice a user will edit multiple files and then save one of them, then try to quit the program which tries to fetch any edited files and throw up a dialog asking the user to save all the other edited files, but as the other edited files are faults the fetch returns no edited files and the program quits.

How can I work around this? I could always walk the tree and ask each file if they're edited, but a fetch seems cleaner.

Thanks for any pointers,


Attachment: smime.p7s
Description: S/MIME cryptographic signature


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.