Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between removePersistentStore and destroyPersistentStoreAtURL?

Tags:

ios

core-data

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

like image 706
trapper Avatar asked Mar 11 '23 13:03

trapper


1 Answers

  • 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.
like image 54
Tom Harrington Avatar answered Apr 28 '23 21:04

Tom Harrington