Search code examples
iosobjective-ccore-datamagicalrecord

IOS coredata Magical record stupAutoMigratingCoreDataStack does not work


Hi I'm using magicalRecord to work with coredata.

I have added 1 more relationship to my coredata and use

[MagicalRecord setupAutoMigratingCoreDataStack];

in may appdelegate I have also made new xcdatamodeld base on old one

But when build and run again. not think change

My old coredata

enter image description here

My newone

enter image description here

I have add 1 more relationship for new one but in file _Article.h nothing change and i can not setup a relationship (for example [article setArticleCategory))

Dont know why the migration not working. Any help is much appreciate. Thanks!


Solution

  • try to add this code to your appdelegate :

    [MagicalRecord setDefaultModelNamed:@"SingPost.momd"];
    NSURL *myPath = [NSPersistentStore MR_defaultLocalStoreUrl];    
    [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreAtURL:myPath];
    

    hope it work !!