Home » IOS » Check Network Availability in IOS Application
IOS

Check Network Availability in IOS Application

Check the internet availability in IOS application using Reachability Plugin.
A sample demonstration plugin is attached here.
The Reachability sample demonstrates the asynchronous use of the SCNetworkReachability API. You can use the API synchronously, but do not issue a synchronous check by hostName on the main thread. If the device cannot reach a DNS server or is on a slow network, a synchronous call to the SCNetworkReachabilityGetFlags function can block for up to 30 seconds trying to resolve the hostName. If this happens on the main thread, the application watchdog will kill the application after 20 seconds of inactivity.

Follow the steps to use a simple network check in application

Step 1: Import “Reachability.h” file in the header file of your viewController

Step 2: Add the following code in the area of your file where you need to check the network availability

Here the function will check the current network availability, and will log it in the console.

Place the desired function in the area, according to the requirement.

Download the sample project

About the author

Vipin

Hi, i am Vipin, a programmer working in Dubai, UAE. I love blogging, and so started TechRounder for sharing my findings and other digital informations with others too. Please feel free to share your feedback with me in the comment section below or you can email me at vipin@techrounder.com.

Add Comment

Click here to post a comment

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

Get latest updates
in your inbox

Subscribe to TechRounder mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.