My project is using AFNetworking.
https://github.com/AFNetworking/AFNetworking
How do I dial down the timeout? Atm with no internet connection the fail block isn't triggered for what feels like about 2 mins. Waay to long....
Changing the timeout interval is almost certainly not the best solution to the problem you're describing. Instead, it seems like what you actually want is for the HTTP client to handle the network becoming unreachable, no?
AFHTTPClient
already has a built-in mechanism to let you know when internet connection is lost, -setReachabilityStatusChangeBlock:
.
Requests can take a long time on slow networks. It's better to trust iOS to know how to deal slow connections, and tell the difference between that and having no connection at all.
To expand on my reasoning as to why other approaches mentioned in this thread should be avoided, here are a few thoughts:
performSelector:afterDelay:...
can be dangerous in multi-threaded applications. This opens oneself up to obscure and difficult-to-debug race conditions.