Reputation: 3222
I'm working with is some kind of catalog app for iPad (only) for my client's company. They has 1000+ of products. Each product can has more than one image. Each product can be set from the web service whether to display on the app or not. So, for example, outdate product's data and images will not existing inside the app. When my client's decided to synchronize data with the web service. All data will be refresh, all images will be downloaded. Any outdated data or unused has to be deleted.
The thing is, he wanted this app to work offline even without internet connection.
Storing all the product's data is fine as I pull all data in JSON format from web service and parse them as a NSMutableDictionary object. Even they will contains data of 1000+ products, It should be fine (I guess).
But for the images, I have no idea how should I keep them inside the device storage and the best way to referencing each of them. Each image should has a size of 10Kb or less.
My current approach (that I can think of) is to
That was the approach I did before with my previous client's project. But that project's app contains less than hundred images. And, I feel like I was doing it the wrong way.
So, if you have any good suggestion, please let me know. Any suggestion are welcome.
Note : I read some closed topic about storing image into CoreData. But, I don't really want to try it now since I don't have any experience with it before and this current project has tight schedule. So, if it's not really needed, I'd love to try it later.
Finally
I decided to go as graver said, migrating my app to use CoreData. But, I might try to store all product's information by using writeToFile first to see how it goes. As graver said, it isn't bad to try something new. Eventually, we will get something.
Upvotes: 1
Views: 169
Reputation: 15213
Your only change is with CoreData. Keep the product details and the local path of the images in the database, but the actual picture files in the storage, ie. a directory inside your app's Documents directory. CoreData provides you performance you can never achieve archiving all the data. And if you have no experience with CoreData, I think you'll save time reading the docs and implementing it, than thinking about complex solutions with archiving, keeping files track and so on.. And you will get experienced with CoreData for the next project :) 2-in-1
Upvotes: 5