I'm not using Core Data for persistent storage at all, I'm using the in-memory store type because I really only need Core Data for its database-like benefits.
In some cases, I'll load a view controller and get data from an API, and populate Core Data with the API's response objects which then populates the view controller through NSFetchedResultsController
.
However, I'll then go to a different view controller, completely not needing the previous one, and make a new API call and need to populate Core Data with those response objects.
My issue is, when I bring in the new ones my old ones are still there. How do I quickly tell the old ones to be gone and to make way for just the new ones?
I tried deleting all the entries manually as shown in this answer but if I load new entries directly after that it crashes my app.
Is there a better way to be doing this?