Want to check is Internet is available or not-available before calling any WEB-SERVER.
I used the Reachiablity which provided by apple to check the internet is on or off. I added this two files into my project. Reachability.h and Reachability.m
In ViewController.h
-(BOOL)connected;
and ViewController.m its Implementation.
-(BOOL)connected{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
return networkStatus != NotReachable;
}
before calling webserver making an condtion
if([self connection] == true){
// Do call web server.
}
else {
// Alert message print. // Please check internet connection.
}
When running the application in both case with WIFI ON or OFF with MACBOOKPRO "Simulator" or on Device. Its always returns true condition.
Please let me know, what should i need to do properly for making reachablity work.
I am using Xcode 6.0.1 IOS SDK 8.0.
@ALL Thank In Advance.