Inherits from NSObject
Declared in AFNetworkReachabilityManager.h

Overview

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

Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.

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

@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus
Discussion

The current network reachability status.

Declared In

AFNetworkReachabilityManager.h

reachable

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

Whether or not the network is currently reachable.

Declared In

AFNetworkReachabilityManager.h

reachableViaWWAN

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

Whether or not the network is currently reachable via WWAN.

Declared In

AFNetworkReachabilityManager.h

reachableViaWiFi

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

Whether or not the network is currently reachable via WiFi.

Declared In

AFNetworkReachabilityManager.h

Class Methods

managerForAddress:

+ (instancetype)managerForAddress:(const void *)address
Discussion

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

Parameters

address

The socket address (sockaddr_in) used to evaluate network reachability.

Return Value

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

Declared In

AFNetworkReachabilityManager.h

managerForDomain:

+ (instancetype)managerForDomain:(NSString *)domain
Discussion

Creates and returns a network reachability manager for the specified 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

+ (instancetype)sharedManager
Discussion

Returns the shared network reachability manager.

Declared In

AFNetworkReachabilityManager.h

Instance Methods

initWithReachability:

- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability
Discussion

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

Parameters

reachability

The reachability object to monitor.

Return Value

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

Declared In

AFNetworkReachabilityManager.h

localizedNetworkReachabilityStatusString

- (NSString *)localizedNetworkReachabilityStatusString
Discussion

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

Declared In

AFNetworkReachabilityManager.h

setReachabilityStatusChangeBlock:

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

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

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

- (void)startMonitoring
Discussion

Starts monitoring for changes in network reachability status.

Declared In

AFNetworkReachabilityManager.h

stopMonitoring

- (void)stopMonitoring
Discussion

Stops monitoring for changes in network reachability status.

Declared In

AFNetworkReachabilityManager.h