trapper
trapper

Reputation: 12003

What is the difference between removePersistentStore and destroyPersistentStoreAtURL?

This isn't much information at all in the documentation.

https://developer.apple.com/reference/coredata/nspersistentstorecoordinator/1468907-removepersistentstore

https://developer.apple.com/reference/coredata/nspersistentstorecoordinator/1468888-destroypersistentstoreaturl

Upvotes: 6

Views: 1284

Answers (1)

Tom Harrington
Tom Harrington

Reputation: 70976

  • removePersistentStore:error: removes the store from the persistent store coordinator. It's not available to use by the app, but the persistent store file is still there and could be re-added.
  • destroyPersistentStoreAtURL:withType:options:error: removes all traces of the persistent store file. You could use NSFileManager methods, but you'd have to know some details about the persistent store file to wipe it out completely. Some are documented-- like the names of the journal file(s). Some are not documented-- like the location and names of external binary files. This method gets everything.

Upvotes: 10

Related Questions