Memory efficient way of inserting an array of objects with Core Data
Posted
by randombits
on Stack Overflow
See other posts from Stack Overflow
or by randombits
Published on 2010-04-09T16:55:59Z
Indexed on
2010/04/10
0:33 UTC
Read the original article
Hit count: 684
I'm working on a piece of code for an iPhone application that fetches a bunch of data from a server and builds objects from it on the client. It ends up creating roughly 40,000 objects. They aren't displayed to the user, I just need to create instances of NSManagedObject and store them to persistent storage.
Am I wrong in thinking that the only way to do this is to create a single object, then save the context? is it best to create the objects all at once, then somehow save them to the context after they're created and stored in some set or array? If so, can one show some example code for how this is done or point me in the direction to code where this is done?
The objects themselves are relatively straight forward models with string or integer attributes and don't contain any complex relationships.
© Stack Overflow or respective owner