Lê Khánh Vinh Lê Khánh Vinh - 2 months ago 13x
iOS Question

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

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
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!


try to add this code to your appdelegate :

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

hope it work !!