0

How could I delete all core objects without slowing down my app.

I have my app connected to a mysql database and every time I make an update on the database, the only way it updates on the app is if I delete all the core data and then reload it. However, this seems to take 30 seconds to do.

King
  • 59
  • 8
  • 2
    If you want to delete all the objects in your database, the easiest way is to remove your database and recreate it: https://stackoverflow.com/questions/1077810/delete-reset-all-entries-in-core-data Else, for specific entities: https://stackoverflow.com/questions/1383598/core-data-quickest-way-to-delete-all-instances-of-an-entity – Larme Jun 06 '17 at 16:15
  • 1
    What is NSPersistentStore and NSPersistentStoreCoordinator? – King Jun 06 '17 at 16:19
  • 2
    Don't repost [questions](https://stackoverflow.com/questions/44392276/using-loop-and-deleteobject-taking-long-time-to-complete-objective-c). Add more context / information. Normally deleting objects is very fast. Which thread Is the code executed on? – vadian Jun 06 '17 at 16:19
  • Sorry, and on the main thread. – King Jun 06 '17 at 16:27
  • @King You're gonna need to post some code. It is pretty hard to use CoreData without knowing what `NSPersistentStore`/`NSPersistentStoreCoordinator` are and that raises questions as to what you are actually doing. – bbum Jun 06 '17 at 21:37

1 Answers1

0

Deleting objects is very fast! I realized my program was slow due to me adding images to the core data.

King
  • 59
  • 8