KSTReachabilityManager
@interface KSTReachabilityManager : NSObject
KSTReachabilityManager wraps the SCNetworkReachability APIs.
-
The shared manager, unless you need to check a specific host name, this should suffice.
Declaration
Objective-C
@property (class, nonatomic, readonly) KSTReachabilityManager *_Nonnull sharedManager;
-
The current flags of the receiver. Calling this method will block until flags can be determined if they are unknown when the method is called.
See
KSTReachabilityManagerFlagsDeclaration
Objective-C
@property (nonatomic, readonly) KSTReachabilityManagerFlags flags;
-
The current status of the receiver. Calling this method will block until status can be determined if they are unknown when the method is called.
See
KSTReachabilityManagerStatusDeclaration
Objective-C
@property (nonatomic, readonly) KSTReachabilityManagerStatus status;
-
Return YES if the host is reachable by WiFi or WWAN, otherwise NO. This method will block to determine if the host is reachable.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isReachable) BOOL reachable;
-
Return YES if the host is reachable by WWAN, otherwise NO. This method will block to determine if the host is reachable by WWAN.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isReachableViaWWAN) BOOL reachableViaWWAN;
-
Return YES if the host is reachable by WiFi, otherwise NO. This method will block to determine if the host is reachable by WiFi.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isReachableViaWiFi) BOOL reachableViaWiFi;
-
The designated initializer.
Monitors the provided networkReachability object for changes, updates its properties and posts the appropriate notification when changes occur.
Declaration
Objective-C
- (nonnull instancetype)initWithNetworkReachability: (nonnull SCNetworkReachabilityRef)networkReachability;
Parameters
networkReachability
The network reachability object to monitor
Return Value
The initialized instance
-
Calls
initWithNetworkReachability:
passing a network reachability object created by callingSCNetworkReachabilityCreateWithAddress()
.Declaration
Objective-C
- (nonnull instancetype)initWithAddress: (nonnull const struct sockaddr_in6 *)address;
Parameters
address
A pointer to the sockaddr_in6 to monitor
Return Value
The initialized instance
-
Calls
initWithNetworkReachability:
passing a network reachability object created by callingSCNetworkReachabilityCreateWithName()
.Declaration
Objective-C
- (nonnull instancetype)initWithDomain:(nonnull NSString *)domain;
Parameters
domain
The domain to monitor (e.g. @“www.google.com”)
Return Value
The initialized instance
-
Unavailable
Undocumented
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE;
-
Unavailable
Undocumented
Declaration
Objective-C
+ (instancetype)new NS_UNAVAILABLE;
-
Start monitoring the networkk reachability object for changes and post a notification when changes occur.
Declaration
Objective-C
- (void)startMonitoringReachability;
-
Stop monitoring the network reachability object for changes.
Declaration
Objective-C
- (void)stopMonitoringReachability;
-
Return a localized string representing the status.
Declaration
Objective-C
+ (nonnull NSString *)localizedStringForStatus: (KSTReachabilityManagerStatus)status;
Parameters
status
The reachability manager status
Return Value
The localized string