I am using AFNetworking in my App for communicating with server. How can i check whether my host(server) is available or not, i should check this before i am sending a request to server.
Using AFNetworking 2.0 that provide method like below you can check instead of using Reachability class.
- (void)viewDidLoad {
[super viewDidLoad];
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
}
After set start-monitoring in to viewDidLoad
you can check any where in to class using Bellow Method.
if ([[AFNetworkReachabilityManager sharedManager] isReachable])
{
NSLog(@"IS REACHABILE");
}
else
{
NSLog(@"NOT REACHABLE");
}