ios - Why isn't core data maintaining persistance in this code? -
this code +(favouritesmodel *) savefavourites: (nsstring *) title and: (nsstring *) subtitle{ favouritesmodel *savedata = [[favouritesmodel alloc] init]; savedata.context = [savedata managedobjectcontext]; nsmanagedobject *task = [[favourites alloc] initwithcontext:savedata.context]; [task setvalue:title forkey:@"title"]; [task setvalue:subtitle forkey:@"subtitle"]; nsstring *titlestr = [task valueforkey:@"title"]; nsstring *subtitlestr = [task valueforkey:@"subtitle"]; [savedata.favouritesdata addobject:titlestr]; [savedata.favouritesdata addobject:subtitlestr]; appdelegate *appdelegate; [appdelegate savecontext]; return savedata; } the data want saved it's not persisting. i've used savecontext() method in "applicationwillterminate" in app delegate too. still if i'm quitting , reopening app, data not there. edit i'm using model class call method in 5 classes. what have add implement data persistence ?