开发者

How to delete all data in CoreData?

开发者 https://www.devze.com 2022-12-10 04:53 出处:网络
Is there a quick way to clear all data of my CoreData without calling deleteObject f开发者_开发技巧or each entity in the model?Delete the persistent store on disk (after calling -[NSPersistentStoreCoo

Is there a quick way to clear all data of my CoreData without calling deleteObject f开发者_开发技巧or each entity in the model?


Delete the persistent store on disk (after calling -[NSPersistentStoreCoordinator removePersistentStore:error:] for any persistent store coordinator that refers to the store). You probably also want to reset any NSManagedObjectContext instances that may have managed object instances from that store before removing and deleting the store on disk.


You can release all your NSPersistentStoreCoordinator and all you NSManagedObjectContest's then delete the file in the FS and recreate it.

0

精彩评论

暂无评论...
验证码 换一张
取 消