What is the best way to interact when the download has been interrupted?

I use ASIHTTPRequest to upload photos to the server, and it works well, but when the connection is lost, the download is interrupted. So what is the best way to deal with this problem? Should this problem be supported by the server to cancel the request?

+4
source share
1 answer

This must be handled by the iPhone side. When the request is not completed due to an interrupt, you must have a column bit to load items.

When an item does not load, do not update this bit. When an element is loaded, you need to update this bit so that you know that this element is loaded.

EDIT

You should use the delegation methods ASIHTTPRequest didFinish or didFailed. In this method, you will track whether the item is loaded or not.

eg. You have created a model class, such as ClsPhoto, in which there are 2 properties: 1 UIImage, and the other - BOOL.

Now, if the photo is uploaded, create the BOOL true variable and don't worry about it. If you didn’t download, save it in False and load the request to the user again, since your download was interrupted, you would like to continue.

This can be done using Core Data or using a SQLITE database or without storing them in memory or NSUserDefaults

+4
source

All Articles