Search code examples
objective-ciosnetwork-programmingxamarin.iosmac-address

Substitute for UIDevice's UniqueIdentifier - what are iOS's network interfaces IDs?


More and more iOS developers who are required to rely upon a device specific identifier for their applications switch from [UIDevice uniqueIdentifier] towards the usage of the device's network card's MAC addresses. This seems to be the commonly accepted solution if you don't want to or cannot use a GUID. I can also see, that everybody is checking for the network device with the ID "en0". Can anybody answer:

  • What is device en0?
  • Is it available on all iPads/iPhones?
  • Is it available if airplane mode is on or the device is not connected to a network?

I found this question UIDevice uniqueIdentifier Deprecated - What To Do Now? but it does not really deal with the details as I'm asking about.


Solution

  • What is device en0?

    Personally I always assumed it means ethernet network, e.g. Linux uses eth0 and BSD-derivates, like OSX, seems to prefer en0, but I could not really confirm it. That's something you can change in most operating systems (but not on iOS, unless jailbroken).

    FWIW other people seems to assume the same but I don't consider this a definitive answer. OTOH it should not really matter much ;-)

    Is it available on all iPads/iPhones?

    AFAIK. Reporting this should be an operating system (not a device) feature and there are no network-less iOS devices (at the moment). I don't have old iOS versions to confirm if it has always been available or not.

    Is it available if airplane mode is on or the device is not connected to a network?

    Yes, it's available in airplane mode using the NetworkInterface.GetAllNetworkInterfaces () API. Tested with my first gen iPad.