开发者

How to delete all data in CoreData?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜