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….
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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?
AFHTTPClientalready 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.