简体   繁体   中英

How do I get the URL of a Core Data persistent store for deletion?

I wish to the function persistentStoreCoordinator.destroyPersistentStoreAtURL(...) . I'm creating my container with it like this NSPersistentContainer(name: "MyProject") what I would like to know is how to get the URL of the persistentStore for use in the first call, in Swift preferably.

Many thanks.

The NSPersistentContainer has a persistentStoreDescriptions property.

That array describes the stores loaded in the coordinator, including their URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM