Inherits from NSObject
Declared in AFNetworkReachabilityManager.h
AFNetworkReachabilityManager.m

Overview

AFNetworkReachabilityManager monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.

See Apple’s Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/))

Warning: Instances of AFNetworkReachabilityManager must be started with startMonitoring before reachability status can be determined.

Tasks

Other Methods

Initialization

Starting & Stopping Reachability Monitoring

Getting Localized Reachability Description

Setting Network Reachability Change Callback

Properties

networkReachabilityStatus

The current network reachability status.

@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus

Declared In

AFNetworkReachabilityManager.h

reachable

Whether or not the network is currently reachable.

@property (readonly, nonatomic, assign, getter=isReachable) BOOL reachable

Declared In

AFNetworkReachabilityManager.h

reachableViaWWAN

Whether or not the network is currently reachable via WWAN.

@property (readonly, nonatomic, assign, getter=isReachableViaWWAN) BOOL reachableViaWWAN

Declared In

AFNetworkReachabilityManager.h

reachableViaWiFi

Whether or not the network is currently reachable via WiFi.

@property (readonly, nonatomic, assign, getter=isReachableViaWiFi) BOOL reachableViaWiFi

Declared In

AFNetworkReachabilityManager.h

Class Methods

managerForAddress:

Creates and returns a network reachability manager for the socket address.

+ (instancetype)managerForAddress:(const struct sockaddr_in *)address

Parameters

address

The socket address used to evaluate network reachability.

Return Value

An initialized network reachability manager, actively monitoring the specified socket address.

Declared In

AFNetworkReachabilityManager.h

managerForDomain:

Creates and returns a network reachability manager for the specified domain.

+ (instancetype)managerForDomain:(NSString *)domain

Parameters

domain

The domain used to evaluate network reachability.

Return Value

An initialized network reachability manager, actively monitoring the specified domain.

Declared In

AFNetworkReachabilityManager.h

sharedManager

Returns the shared network reachability manager.

+ (instancetype)sharedManager

Declared In

AFNetworkReachabilityManager.h

Instance Methods

initWithReachability:

Initializes an instance of a network reachability manager from the specified reachability object.

- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability

Parameters

reachability

The reachability object to monitor.

Return Value

An initialized network reachability manager, actively monitoring the specified reachability.

Declared In

AFNetworkReachabilityManager.h

localizedNetworkReachabilityStatusString

Returns a localized string representation of the current network reachability status.

- (NSString *)localizedNetworkReachabilityStatusString

Declared In

AFNetworkReachabilityManager.h

setReachabilityStatusChangeBlock:

Sets a callback to be executed when the network availability of the baseURL host changes.

- (void)setReachabilityStatusChangeBlock:(void ( ^ ) ( AFNetworkReachabilityStatus status ))block

Parameters

block

A block object to be executed when the network availability of the baseURL host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the baseURL.

Declared In

AFNetworkReachabilityManager.h

startMonitoring

Starts monitoring for changes in network reachability status.

- (void)startMonitoring

Declared In

AFNetworkReachabilityManager.h

stopMonitoring

Stops monitoring for changes in network reachability status.

- (void)stopMonitoring

Declared In

AFNetworkReachabilityManager.h