I'm developing an iPhone app that uses the network. The iPhone communicate with my server via HTTP request and should work on WiFi and 3G.
I currently use NSURLConnection initWithRequest
to send async requests to my server and get responses (but I will soon move to work with ASIHTTPRequest
library)
I understood that with this kind of apps(apps that requires internet connection) I should (must?) use Reachability.
After searching the web and looking at Apple's Reachability example code i still don't understand some basic stuff:
What is the main purposes of Reachability?
In apple's example they detect network issues with the host, WiFi and 3G and present the user with an appropriate message.
Is this the main purpose of Reachability, to show the user a message?
Or do I need to use it for other more practical scenarios? For example if NSURLConnaction
request has failed do I need to use Reachability somehow to resend the request?
What is the proper use of Reachability?
Is it common to use only one instance when app launch, and then listen to network changes? Or should I check myself the reachability status before every network request?
Is it enough to use reachabilityWithHostName
or do I need also reachabilityForLocalWiFi
and reachabilityForInternetConnection
?
One more thing, I understood apple can reject apps that use the network and don't use Reachability.
What are the "must" do methods I should implement?
Will it be enough to just notify the user that currently there is no internet?