AWSKSReachability Class Reference

Inherits from NSObject
Declared in AWSKSReachability.h
AWSKSReachability.m

Overview

Monitors network connectivity.

You can elect to be notified via blocks (onReachabilityChanged), notifications (notificationName), or KVO (flags, reachable, and WWANOnly).

All notification methods are disabled by default.

Note: Upon construction, this object will fetch its initial reachability state in the background. This means that the reachability status will ALWAYS be “unreachable” until some time after object construction (possibly up to 10 seconds, depending on how long the DNS lookup takes). Use the “initialized” property to monitor initialization, or set the callback “onInitializationComplete”.

+ reachabilityToHost:

Reachability to a specific host. Returns nil if an initialization error occurs.

+ (AWSKSReachability *)reachabilityToHost:(NSString *)hostname

Parameters

hostname

The name or IP address of the host to monitor. If nil or empty string, check reachability to the internet in general.

Declared In

AWSKSReachability.h

+ reachabilityToLocalNetwork

Reachability to the local (wired or wifi) network. Returns nil if an initialization error occurs.

+ (AWSKSReachability *)reachabilityToLocalNetwork

Declared In

AWSKSReachability.h

+ reachabilityToInternet

Reachability to the internet. Returns nil if an initialization error occurs.

+ (AWSKSReachability *)reachabilityToInternet

Declared In

AWSKSReachability.h

  hostname

The host we are monitoring reachability to, if any.

@property (nonatomic, readonly, retain) NSString *hostname

Declared In

AWSKSReachability.h

  onInitializationComplete

If non-nil, called when the KSReachability object has finished initializing. If initialization has already completed, calls on the next main thread run loop. This block will only be called once, and then discarded (released). Block will be invoked on the main thread.

@property (atomic, readwrite, copy) AWSKSReachabilityCallback onInitializationComplete

Declared In

AWSKSReachability.h

  onReachabilityChanged

If non-nil, called whenever reachability flags change. Block will be invoked on the main thread.

@property (atomic, readwrite, copy) AWSKSReachabilityCallback onReachabilityChanged

Declared In

AWSKSReachability.h

  notificationName

The notification to send when reachability changes (nil = don’t send). Default = nil

@property (nonatomic, readwrite, retain) NSString *notificationName

Declared In

AWSKSReachability.h

  flags

The current reachability flags. This property will always report 0 while “initialized” property = NO.

@property (nonatomic, readonly, assign) SCNetworkReachabilityFlags flags

Declared In

AWSKSReachability.h

  reachable

Whether the host is reachable or not. This property will always report NO while “initialized” property = NO.

@property (nonatomic, readonly, assign) BOOL reachable

Declared In

AWSKSReachability.h

  initialized

If YES, this object’s status properties are valid.

@property (atomic, readonly, assign) BOOL initialized

Declared In

AWSKSReachability.h