简体   繁体   中英

MagicalRecord not saving?

// Setup magical record
[MagicalRecord setupCoreDataStack];

NSLog(@"Groups at startup: %d", [Group findAll].count);

[Group createEntity];
[[NSManagedObjectContext defaultContext] save];

I've placed this bit of code in my AppDelegate. Everytime I start up the app, I see the count as 0. What am I missing?

Per MagicalRecord's github page..

MagicalRecord provides a background saving queue so that saving all data is performed off the main thread, in the background. This means that it may be necessary to use MR_saveNestedContexts rather than the typical MR_save method in order to persist your changes all the way to your persistent store;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM