Search code examples
iosios5wifi

Check about whether my application is making use of wifi in ios


I need to develop a application where i need to get information or notification whenever my application makes use of internet. I get the code to get notification when wifi status changes but not getting how to get notification when my application try to access the wifi. Any help regarding this is really appreciable.

Thanks


Solution

  • You will have to use reachability class provide by the apple. And register for notification.

    self.reachability = [Reachability reachabilityWithHostName:@"hostName"];
        [reachability startNotifier];
    
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityStatusChanged:) name:kReachabilityChangedNotification object:nil];