SniperCoder SniperCoder - 1 year ago 191
Objective-C Question

How to check internet connection on iOS device?

I'm wondering how I can check if the user is connect to internet through WIFI or cellular data 3G or 4G.

Also I don't want to check if a website is reachable or not, the thing that I want to check if there is internet on the device or not. I tried to look over the internet all that I see is that they check if the website is reachable or not using the


I want to check if the user has internet or not when he opens my application.

I'm using Xcode6 with Objective-C.

Answer Source

Use this code and import Reachability.h file

if ([[Reachability reachabilityForInternetConnection]currentReachabilityStatus]==NotReachable)
         //connection unavailable
         //connection available
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download