问题
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