IOS – best way to queue requests to be sent when connection is reestablished

Solutions Collect From Internet About “IOS – best way to queue requests to be sent when connection is reestablished”

I would definitely recommend AFNetworking, a very well-made networking library which wraps NSURLConnection.

In order to use it for your purpose you need to take advantage of the reachability build-in features of AFHTTPClient as suggested in this other answer.

Basically you can execute and arbitrary block whenever the reachability status of the network changes using the setReachabilityStatusChangeBlock: method of AFHTTPClient.

Just remember to link and import the SystemConfiguration framework, otherwise it won’t work.