Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'iOS and tvOS' started by FEERtheGame, Oct 15, 2019.

  1. FEERtheGame

    FEERtheGame

    Joined:
    Apr 12, 2018
    Posts:
    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.


    Code (CSharp):
    1. NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
    2.  
    3. foreach (NetworkInterface network in networkInterfaces)
    4. {
    5.     IPInterfaceProperties properties = network.GetIPProperties();

  
    6.  
    7.     Debug.Log("Network: " + network.Name +
    8.    " Interface Type: " + network.NetworkInterfaceType +
  
    9.   " Operational Status: " + network.OperationalStatus);
    10.  
    11.     foreach (IPAddressInformation address in properties.UnicastAddresses)
          
    12.     {
              
    13.         Debug.Log("IP Family ... " + address.Address.AddressFamily +
    14.         " Adress: " + address.Address);
          
    15.     }
    16. }

    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 @Unity take a look into this? Are you aware of this problem?
     
    Antho likes this.
  2. Antho

    Antho

    Joined:
    Sep 12, 2012
    Posts:
    6
  3. FEERtheGame

    FEERtheGame

    Joined:
    Apr 12, 2018
    Posts:
    7
    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.
     
  4. Antho

    Antho

    Joined:
    Sep 12, 2012
    Posts:
    6
  5. FEERtheGame

    FEERtheGame

    Joined:
    Apr 12, 2018
    Posts:
    7
    thanks, for the information!