FWNetworkReachabilityManager
@interface FWNetworkReachabilityManager : NSObject
FWNetworkReachabilityManager
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 ofFWNetworkReachabilityManager
must be started with -startMonitoring
before reachability status can be determined.
-
The current network reachability status.
Declaration
Objective-C
@property (nonatomic, readonly) FWNetworkReachabilityStatus networkReachabilityStatus;
-
Whether or not the network is currently reachable.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isReachable) BOOL reachable;
-
Whether or not the network is currently reachable via WWAN.
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readonly, getter=isReachableViaWWAN) BOOL reachableViaWWAN;
-
Whether or not the network is currently reachable via WiFi.
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readonly, getter=isReachableViaWiFi) BOOL reachableViaWiFi;
-
The current radio access technology.
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) NSString *radioAccessTechnology;
-
Returns the shared network reachability manager.
Declaration
Objective-C
+ (nonnull instancetype)sharedManager;
-
Creates and returns a network reachability manager with the default socket address.
Declaration
Objective-C
+ (nonnull instancetype)manager;
Return Value
An initialized network reachability manager, actively monitoring the default socket address.
-
Creates and returns a network reachability manager for the specified domain.
Declaration
Objective-C
+ (nonnull instancetype)managerForDomain:(nonnull NSString *)domain;
Parameters
domain
The domain used to evaluate network reachability.
Return Value
An initialized network reachability manager, actively monitoring the specified domain.
-
Creates and returns a network reachability manager for the socket address.
Declaration
Objective-C
+ (nonnull instancetype)managerForAddress:(nonnull const void *)address;
Parameters
address
The socket address (
sockaddr_in6
) used to evaluate network reachability.Return Value
An initialized network reachability manager, actively monitoring the specified socket address.
-
Initializes an instance of a network reachability manager from the specified reachability object.
Declaration
Objective-C
- (nonnull instancetype)initWithReachability: (nonnull SCNetworkReachabilityRef)reachability;
Parameters
reachability
The reachability object to monitor.
Return Value
An initialized network reachability manager, actively monitoring the specified reachability.
-
Unavailable
Unavailable initializer
Declaration
Objective-C
+ (nonnull instancetype)new;
-
Unavailable
Unavailable initializer
Declaration
Objective-C
- (nonnull instancetype)init;
-
Starts monitoring for changes in network reachability status.
Declaration
Objective-C
- (void)startMonitoring;
-
Stops monitoring for changes in network reachability status.
Declaration
Objective-C
- (void)stopMonitoring;
-
Returns a localized string representation of the current network reachability status.
Declaration
Objective-C
- (nonnull NSString *)localizedNetworkReachabilityStatusString;
-
Sets a callback to be executed when the network availability of the
baseURL
host changes.Declaration
Objective-C
- (void)setReachabilityStatusChangeBlock: (nullable void (^)(FWNetworkReachabilityStatus))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 thebaseURL
.