iOS开发的过程中怎么获取手机的MAC地址
1个回答
2017-09-29
展开全部
加入文件IPAddress.h: /code/IPAddress.hIPAddress.c: /code/IPAddress.c然后使用代码:InitAddresses();GetIPAddresses();GetHWAddresses();int i;NSString *deviceIP = nil;for (i=0; i<MAXADDRS; ++i){ static unsigned long localHost = 0x7F000001; // 127.0.0.1 unsigned long theAddr; theAddr = ip_addrs[i]; if (theAddr == 0) break; if (theAddr == localHost) continue; NSLog(@"Name: %s MAC: %s IP: %s\n", if_names[i], hw_addrs[i], ip_names[i]); //decided what adapter you want details for if (strncmp(if_names[i], "en", 2) == 0) { NSLog(@"Adapter en has a IP of %@", [NSString stringWithFormat:@"%s", ip_names[i]]); }}[/code]
查看原帖>>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询