Reachability: two callback threads and one App Store warning
ARC and GCD Compatible Reachability Class for iOS and MacOS. Drop in replacement for Apple Reachability
At a glance
- What is it?
- tonymillion/Reachability is an ARC and GCD compatible drop-in replacement for Apple's Reachability class on iOS and macOS. Its two callback styles land on different threads, its WWAN switch can declare cellular offline, and its README opens with a warning about App Store rejections whose only documented remedy is renaming the class.
- Who is it for?
- Reachability is a good fit when you want to react to interface changes and nothing more, and a poor fit when you need to know whether a request will actually succeed.
- Can I use it commercially?
- Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 19 days ago.
- What is it written in?
- Mainly Objective-C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- tonymillion/Reachability6,940 ★ · -7
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| tonymillion/Reachability | 6.9k | 6.9k |
-7 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The README opens with an App Store rejection warning
The first line of the file is a WARNING, not a feature list. It reports that apps have been rejected when Reachability is used inside a framework, and it states that the only solution found so far is to rename the class. No review rule is named, no policy is linked, and no reason is offered for why a type name would trigger a rejection at all.
That warning sits awkwardly beside the repository layout, because the tree still carries both a Framework/ directory and a Sources/ directory alongside Reachability.h, Reachability.m, Reachability.podspec and Package.swift. The packaging routes a modern project would reach for are present in the repository, while the project's own advice for the framework route is to change the type's name. Settle that question before you wire it up, not after a review bounces the build.
Blocks land on a background thread, notifications on the main thread
Two delivery styles ship side by side and they land on different threads. The block callbacks, reachableBlock and unreachableBlock, are called on a background thread, so any UI work has to be dispatched onto the main queue yourself. The NSNotification path is the opposite: notifications arrive on the main thread, so you can update the interface straight from inside the handler. Picking the notification style to avoid a dispatch is the practical reason to know this.
// Allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// Set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
// keep in mind this is called on a background thread
// and if you are updating the UI it needs to happen
// on the main thread, like this:
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"REACHABLE!");
});
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};The sample states the background thread contract in a comment rather than leaving it as folklore, which is the single most useful thing in the file.
Starting the notifier makes the object retain itself
One commented line in the sample has real consequences: start the notifier and the reachability object retains itself. A local variable is therefore not a safe owner, which is why the Swift sample parks the object in a stored property, declared as `var reach: Reachability?`, before anything starts.
The Swift path also allocates differently from the Objective-C one. It calls `Reachability.forInternetConnection()`, while the Objective-C sample calls `reachabilityWithHostname:` with a host name string. The two are not syntax variants of a single call, so choose the form that matches your question: a named host, or having a route out at all.
import Reachability
var reach: Reachability?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Allocate a reachability object
self.reach = Reachability.forInternetConnection()
// Set the blocks
self.reach!.reachableBlock = {
(reach: Reachability?) -> Void in
// keep in mind this is called on a background thread
// and if you are updating the UI it needs to happen
// on the main thread, likereachableOnWWAN turns the cellular radio into an offline state
One flag decides whether cellular counts as online. Setting reachableOnWWAN to NO asks the object to treat the WWAN connection, spelled out in the sample as 3G/EDGE/CDMA, as a non-reachable connection, and the stated reason is thrift: a video streaming app might rather treat cellular as offline to spare the user's data plan. The flag sits on the object and is set before the notifier starts, so it is configuration rather than something you query later.
The same sample shows the notification route to the same end, which is how the option is meant to be used with either callback style:
// Allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// Tell the reachability that we DON'T want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// Here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotificationNotice the vintage gap inside one file. The cellular switch is described in 3G, EDGE and CDMA terms, while the samples beside it are labelled Swift 3 and use UIApplicationLaunchOptionsKey. The class is presented as current for ARC and GCD while its radio vocabulary predates both.
Two sample apps and a podspec, but only one documented install path
The only install route written down is manual and it is three steps. Add the .h/m files to the project, go to Project, then TARGETS, then Build Phases, then Link Binary With Libraries, press the plus in the lower left of the list, and add SystemConfiguration.framework.
Nothing beyond that is documented. There is no CocoaPods instruction and no Swift Package Manager instruction, even though Reachability.podspec and Package.swift sit at the top level, and the BSD-2-Clause terms live in LICENCE.txt rather than in the instructions. Two runnable samples ship alongside the library, iOSReachabilityTestARC/ and MacOSReachabilityTestARC/, and those are the fastest way to watch the class work on both platforms before you adapt it to your own code.
Tag 3.2 and tag 3.1 are the answer to old assign build errors
The bug policy is written in capitals twice. The first instruction is to test on a device before opening anything. The second names an older fallback: before reporting iOS6 or iOS5 build errors, switch to tag 3.2 or 3.1, which support assign types.
The version picture underneath that advice is thin. The newest listed release is 3.4b1, labelled 3.4 Preview release beta 1 and published on 6 April 2019, while the default branch received its last push on 27 October 2026. The branch has been pushed since the newest tag without producing another listed release, so pinning to a tag gets you 2019 code, and building from master gets you something no release names. There is no version scheme in the documentation to help you decide which of those two you are actually shipping.
Gaps the documentation leaves open
Three gaps are worth knowing before you build on this class.
First, the file does not say which review rule the framework rejection came from, so renaming the type cures the reported symptom without explaining it, and you will meet the same wall again under a different name if the rule is about frameworks rather than about the name.
Second, nothing states whether a reachable interface means a working path to the internet. Read the result as interface state, not as a connectivity test, and keep a genuine failure path for requests that fail anyway.
Third, no supported way to stop or tear down the notifier is documented. Since the object retains itself once started, how you release it is left for you to work out. The wiki is used to list projects that use the class rather than to answer questions, and the repository carries no homepage of its own, so the two places a question could be answered are both outside the file.
Editorial conclusion
Reachability is a good fit when you want to react to interface changes and nothing more, and a poor fit when you need to know whether a request will actually succeed. Before you depend on it, check three things: whether you are shipping inside a framework, because the project's own advice there is to rename the type; which thread you are on when your callback fires, since blocks and notifications disagree; and how old the code is, since the newest listed release is 3.4b1 from April 2019 while the default branch was last pushed on 27 October 2026. Keep a real request failure path alongside it, because interface state is not a connectivity test.
Frequently asked questions
How do I use Reachability in an iOS app?
Add Reachability.h and Reachability.m to the project, then link SystemConfiguration.framework under Build Phases, Link Binary With Libraries. Allocate an object, either with reachabilityWithHostname: and a host name, or with Reachability.forInternetConnection(), then set reachableBlock and unreachableBlock, or observe kReachabilityChangedNotification and read the object passed to your handler.
What does reachable actually mean in Reachability?
It is a property of a network interface rather than a promise about your traffic. Setting reachableOnWWAN to NO makes the object treat the WWAN connection (3G/EDGE/CDMA) as non-reachable, which is how you get cellular to read as offline and save a data plan. Blocks report reachable and unreachable on a background thread, notifications on the main thread.
Will shipping Reachability inside an iOS framework get the app rejected?
The README reports that apps have been rejected when Reachability is used in a framework, and says the only solution so far is to rename the class. No specific review rule is named, and no policy is cited. The repository still ships a Framework/ directory alongside Sources/, so the packaging is there even though renaming is the stated remedy.
Which version of Reachability should I use, and how current is it?
The newest listed release is 3.4b1, a 3.4 preview beta published on 6 April 2019, and the default branch was last pushed on 27 October 2026. For iOS6 or iOS5 build errors the file points you at tag 3.2 or 3.1, which support assign types. It also asks you to test on a device before opening any issue.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/tonymillion-reachability)Star history chart for your README
[](https://hysenlabs.com/projects/tonymillion-reachability)Was this useful?