Is it bad practice to test for reachibility of a web service by using a NSURLConnection call on a certain method that returns YES if the connection exists?
I looked at other ways of doing it but couldn’t figure out ho to test if the specific service is available rather than WiFI or the like.
There’s
SCNetworkReachability(see Apple’s Reachability sample code) but that only checks whether a server should be reachable, it doesn’t tell you whether a service is actually available (running). For that you do have to try to use it. Just make sure to not usesendSynchronousRequest:returningResponse:error:on the main thread as that is synchronously and will block the thread until it’s done. If you do that on the main thread the UI will freeze until either the service has responded or timed out. So either use the asynchronous methods ofNSURLConnection(the “recommended” way) or use the synchronous method on a separate thread. The former is easier/better in my opinion.