//Somewhere in your code
- (NSString *)deviceIPAdress {
InitAddresses();
GetIPAddresses();
GetHWAddresses();
return [NSString stringWithFormat:@"%s", ip_names[1]];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
ipAddress.text = [self deviceIPAdress];
}
下载示例
具体下载目录在 /2013年资料/3月/31日/iOS开发之获取本机IP地址的方法