获取ios设备mac地址

来源:互联网 发布:南极科考站避孕套知乎 编辑:程序博客网 时间:2024/04/29 05:00
using UnityEngine;using System.Collections;using System.Net.NetworkInformation;public class NetWorkInfo : MonoBehaviour{void Start ()    {        Debug.Log(GetMacAddress());    }    public static string GetMacAddress()    {        string physicalAddress = "";        NetworkInterface[] nice = NetworkInterface.GetAllNetworkInterfaces();        foreach (NetworkInterface adaper in nice)        {                        Debug.Log(adaper.Description);            if (adaper.Description == "en0")            {                physicalAddress = adaper.GetPhysicalAddress().ToString();                break;            }            else            {                physicalAddress = adaper.GetPhysicalAddress().ToString();                if (physicalAddress != "")                {                    break;                };            }        }        return physicalAddress;    }}

原创粉丝点击