chuplu
chuplu

Reputation: 164

detecting the network availablity in ios

I want an app to be done in IOS. The app has to give a notification to the user when the network is lost. Is it possible to check the network status using Objective C? is it a lot of work?

I am new to ios development and the person who is coding says this will take a few hours to write.

Also i want a vcard sharing script for ios. the developer says it will take 5 days to complete the task.

can any one help me on this? Am tired of hearing many excuses from his side and unable to proceed further.

thank you

Upvotes: 0

Views: 69

Answers (1)

Gursharn Kaur
Gursharn Kaur

Reputation: 148

 If you want to check reachability before some code execution you should just use..You can use reachability class for checking network status..



   Reachability *reachability = [Reachability reachabilityForInternetConnection];    
   NetworkStatus internetStatus = [reachability currentReachabilityStatus];
    if (internetStatus != NotReachable) {
     //my web-dependent code
     }
     else {
      //there-is-no-connection warning
     }

  You can also add a reachability observer somewhere (i.e. in viewDidLoad):

   Reachability *reachabilityInfo;
   [[NSNotificationCenter defaultCenter] addObserver:self
                                     selector:@selector(myReachabilityDidChangedMethod)
                                         name:kReachabilityChangedNotification
                                       object:reachabilityInfo];

Upvotes: 1

Related Questions