I am writing an application that uses Synchronous NSURLConnection(s) and am finding that my application hangs if the url entered is incorrect. I tried to set a time out of .5 seconds but it does not seem to take. I read somewhere that it is not possible to set a time out on a Synchronous request (and yes it is very important to the application that the request remains synchronous) but am not sure if this is true. Does anybody know how to set a timeout on a synchronous NSURLConnection or how to time out a given command?
A:
Instantiate and work with an NSURLConnection yourself. If you really can't get away from synchronous (smells like bad design to me), run the runloop – preferably in a private mode – while the connection is going to approximate the sync behaviour.
Mike Abdullah
2010-08-12 00:02:08