Reachability considered harmful

Like many, I have relied on Apple’s Reachability samples over the years to determine internet connectivity.

Generally it works really well, and returns immediately. However, in certain flakey internet situations (for example, on the slopes of Japan with ‘3G’ that isn’t actually working), the method can hang until it times-out (which can take over a minute). Toggling airplane mode is a workaround to make reachability return immediately, and can be used to diagnose a Reachability-related hang.

Recommendation: don’t perform reachability tests on the main thread. Rather, do it periodically in the background, use only cached values on the main thread.


Leave a Reply

Your email address will not be published. Required fields are marked *