getting ip address in iphone development

NSString*  ip=@“”;

NSURL *url = [[NSURL alloc] initWithString:ip];

NSString *ans = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error];


one more method



Import UIDevice-Reachability.h in your project then try with one of those commands:

NSString *myIp = [UIDevice localIPAddress];

NSString *myIp = [UIDevice localWiFiIPAddress];

NSString *myIp = [UIDevice whatismyipdotcom];




One Reply to “getting ip address in iphone development”

Leave a Reply

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