Reputation: 1341
I'm doing a little iOS app for the subway of my city. It has the following features
I have a server that takes the news and encode them in JSON. From the iPhone, I request the JSON async, parse it and store the info in an NSArray of NSDictionaries (with keys: date, title, content, seeMoreUrl)
This could be bought as a little RSS feed. I saw some examples and they used a SQLite db to store the data. I'm not sure how necessary would this be, as I'm only planning on showing the 5 latest news and I'm not loading the whole content, just title and a iPhone-designed paragraph.
I have serious doubts with the promotions tough. I would request a file called promotions.json with the url of each promotion and the url they link to, like this
[
{
"imgSource":"http:\/\/www.domain.com\/promotions\/1.png",
"url":"http:\/\/www.domain.com\/freeRide"
},
{
"imgSource":"http:\/\/www.domain.com\/promotions\/54.png",
"url":"http:\/\/www.cheapCarRental.com\/promotions-to-subway-users"
}
]
Then, I don't know what to do. Should I download all images to the documents folder and then when the users click in view promotions, load every pic I found in that directory intro the coverflow-like View? Should I implement a SQLite for the news and also use it to store the images as BLOBs? Should I just keep them in memory?
Upvotes: 0
Views: 203
Reputation: 124997
What do you want your app to do? What will users want the app to do? Would they prefer to pay the price in terms of data usage and battery usage to download all the images and probably get a snappier user experience, or would they prefer occasional lags in the interface as images are downloaded on demand in return for longer battery life and decreased data usage? It's up to you to balance those factors.
Upvotes: 1
Reputation: 9010
You could save the images to the Library/Caches folder (Apple won't like saving to Documents folder without good reason - my app was rejected because of this. See guidelines.). Then, you have a cache file, which is essentially a plist that saves the url (the key) and the path of its corresponding image saved on the disk (the value).
Upvotes: 1