System.Net.NetworkInformation.NetworkInterface broken on iOS since Unity Version 2019.2.7

With Unity Version 2019.2.7 System.Net.NetworkInformation.NetworkInterface is broken when built to iOS.

Traversing through all NetworkInterfaces (with NetworkInterface.GetAllNetworkInterfaces()) gives a list of all networks, but…

  • NetworkInterfaceType is ALWAYS 0 (instead of for example: NetworkInterfaceType.Unknown, NetworkInterfaceType.Ethernet, etc.)
  • OperationalStatus is ALWAYS Unknown
  • GetIPProperties().UnicastAddresses is ALWAYS empty

This bug was first introduced with Unity Version 2019.2.7 and still exists in Version 2019.2.9
In Unity Version 2019.2.6 everything is working.

NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();


foreach (NetworkInterface network in networkInterfaces)

{
    IPInterfaceProperties properties = network.GetIPProperties();
  

    Debug.Log("Network: " + network.Name + 
   " Interface Type: " + network.NetworkInterfaceType +
  
  " Operational Status: " + network.OperationalStatus);


    foreach (IPAddressInformation address in properties.UnicastAddresses)
          
    {
               
        Debug.Log("IP Family ... " + address.Address.AddressFamily + 
        " Adress: " + address.Address);
          
    }

}

Unfortunately downgrading isn’t an option, because Apple will reject all builds with Deprecated API Usage of UIWebView. This was fixed this with Unity Version 2019.2.7, but now the System.Net.NetworkInformation.NetworkInterface is broken, and I can’t get the local IP-address of the device, which I need in my game.

I’ve already submitted a bug report, but neither get an answer nor a confirmation email.
Can please somebody @ take a look into this? Are you aware of this problem?

1 Like

No luck, I assume? The issue is still in 2019.2.16, I opened a bug report and got a confirmation email: https://fogbugz.unity3d.com/default.asp?1206197_8iknsvch32odjjuu

thanks for writing up those details

One month after I filed the bug report, Unity informed me, that they successfully reproduced the bug and that they are working on a fix… well: no fix so far, so I use a workaround to get the local IP address.

Unity QA told me this should be fixed in 2019.2.17

thanks, for the information!