Magical Record Truncate not working after app terminate

南笙酒味 提交于 2019-12-08 00:53:57

问题


hey all i've code like this

if ([cellValue isEqualToString:@"Logout"])
    {

        NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread];
        [EUserBrief MR_truncateAllInContext:localContext];
        [DownloadList MR_truncateAllInContext:localContext];    
    }

the code i want to truncate all data on entities [EUserbrief] and [DownloadList].. the code working fine, but after app terminate and i get in , EuserBrief data and downloadlist still there,,, any solution for this?


回答1:


You need to call

[localContext MR_save];

Your changes will not be persisted to any data store without saving.



来源:https://stackoverflow.com/questions/16504080/magical-record-truncate-not-working-after-app-terminate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!