Nick ONeill
Nick ONeill

Reputation: 7379

MagicalRecord is deleting all the created objects each time app loads

I'm not quite sure what's going on but every time my app loads in the iOS simulator the data that was persisted in my app with MagicalRecord is being deleted & recreated. Perhaps this means the data isn't being persisted?

I have no idea what's going on. In my app delegate I have:

[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"HFDatabase.sqlite"];

In my didFinishLaunching... method as well as [MagicalRecord cleanUp]; in applicationWillTerminate method. The log is also outputting the following:

Context DEFAULT is about to save. Obtaining permanent IDs for new 20 inserted objects

Which I assume means the data is being saved. Yet it recreates the data every time. Any ideas?

Update

It appears as though it simply deletes the database each time I rebuild the app. Is that supposed to happen? Any way to stop that from happening?

Upvotes: 0

Views: 510

Answers (1)

DavidA
DavidA

Reputation: 3172

From your comments it looks like you were missing a save method. Do [localContext MR_saveToPersistentStoreAndWait]; after your changes.

Upvotes: 2

Related Questions