Posts

Showing posts from March, 2015

Check Internet Connectivity Using AFNetworking 2.0

I have created  NetworkRechabilityMonitor class to get the Internet Connection status in my app using AFNetworking 2.0 library. 1. Create an NSObject class naming  NetworkRechabilityMonitor , add below code in respective Header & Implementation files.   NetworkRechabilityMonitor.h #import <Foundation/Foundation.h> @interface NetworkRechabilityMonitor : NSObject +( void )startNetworkReachabilityMonitoring; +( BOOL )checkNetworkStatus; @end NetworkRechabilityMonitor.m #import "NetworkRechabilityMonitor.h" @implementation NetworkRechabilityMonitor #pragma mark - Start Monitoring Network Manager +( void )startNetworkReachabilityMonitoring {     [[ AFNetworkReachabilityManager sharedManager ] startMonitoring ]; } #pragma mark - Check Internet Network Status +( BOOL )checkNetworkStatus {     return [ AFNetworkReachabilityManager sharedManager ]. reachable ; } @end 2.