How to save directly to persistent storage without saving data in memory

I have an application that downloads some documents from the server and stores them in persistent storage (Sqlite). I store the documents data in a NSData

property NSManagedObject

, and every time I load a new document, basically the app stores the data in persistent storage, but it also stores it in memory, which I don't want. Is there a way to make it crash? Somehow I would like to free memory and keep the data only in the database. Hope this makes sense, I am new to Core Data.


source to share

2 answers

You can turn NSManagedObject, causing refreshObject: mergeChanges: .



One option is to read it in one or more managed objects that are local to the scope of the routine, and then when they go out of scope, they will be freed from memory. (You can save them first.)



All Articles