views:

130

answers:

5

I need help with downloading from webserver... What i currently do is get XML file from web servers that contains image locations, parse XML, download each image, store image on iphone, and store image name to sql database. This takes lots of time because there is large amount of images to be downloaded and i am downloading one by one.

My app update just got rejected because reviewer decieded that downloading is too long... What is funny, last two updates passed without problems..

I was thinking about zipping those images on server and sending zip file to iphone, unzipping it there, or packing images together with binary and sending it to apple.

Any advice on how to make download faster, would be appreciated. Thanks.

+1  A: 

Do you change those images often? Or only once per release if at all? If they change with each release only I'd package them. If they're almost never changed, go with the one huge download (so people don't have to redownload when updating) and if they're change often, download them file by file but try to do 2-3 files at once using asynchronous download (if supported).

Mario
My client wants to avoid 20MB data cap that app store puts on downloading applications without wifi, and some images change on weekly basis. Currently application manages changed images by checking server and asking what has changed from last update and downloading new images,so those intermediate updates are not problem, only the first one.. how about packing images in one big file and unpacking it on iphone? was thinking that i would gain on reduced network connections, but would lose in time needed for iphone to unpack those files...
kviksilver
A: 

One way to speed up download of those images is to put them on a CDN. Some CDNs, like Limelight have special network optimizations for sending data to mobile devices. They also just do a better job of routing content, and have higher capacity for transmitting content. What's nice about this approach is that you might not have to change your app. However CDNs can be pricy.

Chris Henry
+3  A: 

BTW, zip won't help with images. They are already compressed, so it will just add overhead. Make sure your images are not any larger than you need for display and I'd do what Mario suggested above and download them in multiple async calls (at least make the one big call asynchronous.)

A key principle of UI design is to display partial results (unless they are invalid or misleading) so that the user understands that progress is being made.

If you really need all the images to make it valid, you can download a few and display them grayed out (alpha = 0.4) or something so that it's clear that this is a partial result, but that progress is being made. The reviewer probably felt that it was taking too long to startup.

joelm
Well i let user know that download will take some time, show progress bar for each downloaded item, all by the book and they still want me to reduce time to download all the stuff.. Without all those data my app is useless, can i post link to app itself (it is free) so that you can check UI design for further help if needed? Thanks...
kviksilver
+1 I really doubt you need *all* the images for your app to be usable.
tc.
It's not entirely true to say zip won't help. If there are a lot of small images, the download time will be dwarfed by the connection setup time and the overhead of the http headers for each item. Having one zip file that downloads all images in a single connection with one set of headers could well be an improvement. That said, it seems unlikely that using a zip is the best solution here.
JosephH
A: 

Likely, your images are just way too large. You said you're worried about the 20MB app limit, but I think at that point, your images are just way too large for the phone.

Rather than zipping the files, I'm pretty sure you need to downsample the size of the images. Not only that, but you should only download the ones that you need, when you need them.

If you still want to have bulk downloads, why not have it as a side option rather than the default implementation?

David Liu
+1  A: 

1) I would use something like an NSOperationQueue to download around three images at a time in the background. Much more than that and the UI starts getting choppy.

2) Also display some kind of loading indicator while this is going on.

3) What format are your images in? If you are transferring over the network you should use JPG, and consider setting the quality level to something smaller (say 6 even 5). To offset the loss of quality you could send down larger images, even with the larger number of pixels you can easily be better off with a lower quality compression.

4) If you have to use PNG to preserve transparency, consider using PNGCrush on the images before sending. As noted, zip will do pretty much nothing.

Kendall Helmstetter Gelner