Question

Can any one get me idea to find whether iphone device connected to 3G /Wifi using Reachability.kindly get me some samples / URL's .im new in this iphone development.

Thanks in advance

Was it helpful?

Solution

You could try to start from the Rechability example from Apple http://developer.apple.com/iphone/library/samplecode/Reachability/

OTHER TIPS

firstly add SystemConfiguration.framework to your project

//Class.h
#import "Reachability.h"
#import <SystemConfiguration/SystemConfiguration.h>

- (BOOL)connected;

//Class.m

- (BOOL)connected
{
    Reachability *reachability = [Reachability reachabilityForInternetConnection];
    NetworkStatus networkStatus = [reachability currentReachabilityStatus];
    return networkStatus != NotReachable;
}
Then, I use this whenever I want to see if I have a connection:

if (![self connected]) {
    // Not connected
} else {
    // Connected. Do some Internet stuff
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top