Detecting Network Status

Grab the sample code from here from Apple.

1) Add SystemConfiguration.framework into your project.

2) Drag & Drop 2 files Reachability.h & Reachability.m files into your project.

3) Go to your classXYZ.h file & declare – @class Reachability

4) Create few instances as follows into your class.

5) Add following method into your class.
{code type=typescript}- (void) checkNetworkStatus:(NSNotification *)notice;

6) Add  #import "Reachability.h" to the .m file where you are implementing the check

7) In the .m file of where you are implementing the check, you can place this in one of the first methods called (init or viewWillAppear or viewDidLoad etc):

8) Set up the method for when the notification gets sent and set whatever
checks or call whatever methods you may have set up (in my case, I just set a BOOL)

9) In your dealloc or viewWillDisappear or similar method, remove yourself as an

2 thoughts on “Detecting Network Status

  1. How can we identify that iphone is in airplane mode. But internet is working with wifi? Is their anyways to know this in Reachbility? I tried but not able to get such message as no specific comments are there in code. Can you please help me for identifying the portion of code that indicates that cell is in airplane mode?

    • Hey ! Dhiren – This was a post from Nimit. I have understood your question. I will put a post regarding this or update this post in very near time. Your response/comments are valuable to us.

Leave a Reply

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