views:

84

answers:

1

Hi All,

I have implemented the usual Asynchronous connection mode in one of my apps and it works fine. The error handling is also happening properly. I also have implemented the Reachability API by Apple.

I would like to have for example 5 retires to be done when there is a network failure.

Kindly suggest me a good way to implement this.

A: 

Implementing the retry option was simple actually.

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

Use this method to make sure you identify the error condition while a try is failed. You can reinitiate the request again inside this method with a int flag has the NO_MAX_RETRY(eg.5) set.

- (void)connectionDidFinishLoading:(NSURLConnection *)connection this method when returned the connection is successful and you can reset the retry flag and release the retry routine.

Futur