Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Meta data will not be saved using MR_saveToPersistentStoreAndWait #688

Closed
sbhklr opened this Issue · 2 comments

3 participants

@sbhklr

I tried to save meta data to a persistent store using MR_saveToPersistentStoreAndWait method. This does not work as the setMetadata: forPersistentStore: method doesn't update the change count. Therefore the NSManagedObjectContext method hasChanges will return NO and the save method returns. As a work around I saved the context chain manually. But I think it would be nice to have a parameter like enforceSave or similar so we can use MagicalRecord also for saving meta data.

@casademora
Owner
@sbhklr

I understand that this is not the purpose of the MagicalRecord API. However, since MagicalRecord manages the context stack, I would assume that a call to saveToPersistentStoreAndWait would ultimately save any changes. In case of changes to the meta data, this is not true. Changes are not recognized by the hasChanges method. I wonder whether this is a bug in Core Data. Now to save the meta data, I basically have to re-implement saveToPersistentStoreAndWait only without the hasChanges check. This means that I don't have knowledge about the context stack because it is managed by Magical Record, but I have to save the contexts all the way up to the root context. I guess I can live with that, but it feels a bit quirky.

@casademora casademora was assigned by sbhklr
@tonyarnold tonyarnold closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.