Skip to content
Network reachability detection library for iOS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Classes changed api for ipv6 Jun 10, 2016
Examples changed api for ipv6 Jun 10, 2016
FBNetworkReachability.xcodeproj changed api for ipv6 Jun 10, 2016
Tests Available for CocoaPods, Changed MRC to ARC Mar 22, 2014
.gitignore Available for CocoaPods, Changed MRC to ARC Mar 22, 2014
Default-568h@2x.png Available for CocoaPods, Changed MRC to ARC Mar 22, 2014
FBNetworkReachability.podspec
LICENSE Added LICENSE Mar 22, 2014
README.md

README.md

Network Reachability Detector

You can use FBNetworkReachabilty class to get network reachability on iOS device.

Usage

(1) Getting connection mode

FBNetworkReachabilityConnectionMode mode =
	[FBNetworkReachability sharedInstance].connectionMode;
switch (mode) {
	case FBNetworkReachableNon:
	break;

	case FBNetworkReachableWiFi:
	break;

	case FBNetworkReachableWWAN:
	break;
}

You can get the connection mode from 'connectionMode' property.

(3) Checking reachability

if ([FBNetworkReachability sharedInstance].reachable) {
	:
}

You can get the rechability flag.

(4) Using notification

FBNetworkReachability posts FBNetworkReachabilityDidChangeNotification when the network reachability changs. To use the notification you can write the event driven code.

[[NSNotificationCenter defaultCenter]
	addObserver:self
	   selector:@selector(didChangeNetworkReachability:)
	       name:FBNetworkReachabilityDidChangeNotification
	     object:nil];
[[FBNetworkReachability sharedInstance] startNotifier];

- (void)didChangeNetworkReachability:(NSNotification*)notification
{
	FBNetworkReachabiity* network = [notification object];
		:
}

Features

  • FBNetworkReachabiity does not work in background.
  • FBNetworkReachabiity posts the newest network rechability change.
  • The instances has same URL points to same instance internally.
  • Thread-safe
  • Requirements: SystemConfiguration.framework

Customize

(non)

Installation

You should copy below files to your projects.

FBNetworkReachability.h
FBNetworkReachability.m
SystemConfiguration.framework

License

see LICENSE file

You can’t perform that action at this time.