Bug 11161 - Mac Address returning the first two digits incorrectly
Summary: Mac Address returning the first two digits incorrectly
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-14 11:46 UTC by Jonathon bullock
Modified: 2016-12-22 14:25 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample Project (7.33 MB, application/zip)
2013-03-14 11:47 UTC, Jonathon bullock
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Comment 1 Jonathon bullock 2013-03-14 11:47:31 UTC
Created attachment 3619 [details]
Sample Project
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-03-14 19:20:00 UTC
I can't reproduce with any of the following devices, in all cases the mac address matched the wifi address.

iPad2 w/GSM iOS 6.1.2
iPad3 iOS 6.0.1
iPhone4 GSM iOS 5.1.1

I'll try iPad4 and iPhone5 tomorrow.
Comment 3 Sebastien Pouliot 2013-03-15 12:03:12 UTC
sample works for me too, tested on:

iPad1 3g, iOS 5.1
iPad3 wifi, iOS 6.1.2
iPodTouch 4th, iOS 5.1.1
iPodTouch 5th, iOS 6.0.1

the only change I made was to make it an universal app to test it on the iPods
Comment 4 Simon Hu 2013-03-15 12:11:17 UTC
Same situation like Jonathon bullock.

Cannot get the correct MAC address.

iPhone5, iOS 6.1.2
iPad mini, iOS 6.1.2

only change the target from iPad to universal.

Below is my XS information:
----------------------------
Xamarin Studio
Version 4.0.2 (build 18)
Installation UUID: 
Runtime:
	Mono 3.0.7 (master/514fcd7)
	GTK 2.24.16
	GTK# (2.12.0.0)
	Package version: 300070000

Apple Developer Tools
Xcode 4.6.1 (2067)
Build 4H512

Xamarin.iOS
Version: 6.3.0.255 (Business Edition)
Hash: ba05545
Branch: 
Build date: 2013-08-03 15:54:27-0500
Comment 5 Sebastien Pouliot 2013-03-15 12:58:05 UTC
PJ, can someone with QA test this with either (or both) 6.1.2 or 6.3 across several devices ?
Comment 6 Sebastien Pouliot 2013-03-15 13:09:20 UTC
and I meant the released versions of 6.2.1.x (not 6.1.2 :-) and 6.3.0.x
Comment 7 GouriKumari 2013-03-15 14:26:39 UTC
Tested with following devices:

Reproduced the error in :

iPhone5 : 6.1.2
The first two digits in mac address retrieved from device by the app and in Settings > General > About didn't match

Xcode Device log: https://gist.github.com/GouriKumari/c20f58adabe2096d00ec

Couldn't reproduce the error in:

iPad2 5.1.1
iPad 6.0.1
iPadMini

iPod 6.1.2


TestEnv:
https://gist.github.com/GouriKumari/64217d0933964f23c024
Comment 10 Martin Baulig 2013-06-26 08:10:34 UTC
I'm also seeing a different first two digits on my iPhone 5.

However, you won't be able to access the Mac address anymore with iOS 7:
http://www.adexchanger.com/mobile/apple-closes-another-mobile-tracking-loophole-with-ios-7/

See also
http://stackoverflow.com/questions/677530/how-can-i-programmatically-get-the-mac-address-of-an-iphone

If customers need this, then maybe we should implement that new API to get the advertisingIdentifier.
Comment 11 Sebastien Pouliot 2013-06-26 08:15:20 UTC
Martin, if you have hardware to duplicate this then please have a look why as it could be a memory corruption and affect other NetworkInfo-like API.

As for `advertisingIdentifier` there's no need to implement it, i.e. it's been available (and implemented) since Apple started offering it (iOS 6.0).
Comment 12 Martin Baulig 2013-06-26 08:17:10 UTC
Sure, no problem.
Comment 13 Martin Baulig 2013-06-26 08:29:59 UTC
Ok, there's definitely something wrong.
I just tested with this code: https://gist.github.com/Coeur/1409855/raw/a8122cba67b43400b891aa77d100834c1c0c64ef/Get+iOS+MAC+address.m and that's returning the correct address.

Will investigate after lunch.
Comment 14 Martin Baulig 2013-06-26 10:41:31 UTC
After some debugging, it turns out that the MAC address actually isn't "wrong".

NetworkInterface.GetAllNetworkInterfaces() returns 4 network interfaces: ap1, en0, en1 and awdl10.

I looked at their MAC addresses and en0 is what you see as "Wi-Fi Address" in Settings General / About.  ap1 differs in the first two digits, en1 in the first two and last two.  awdl10 is completely different.
Comment 15 PJ 2013-11-19 16:44:59 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 16 GouriKumari 2016-01-11 22:26:53 UTC
Please update the bug, if the issue still occurs with latest XI and XS builds. Moving the target milestone to "far future".
Comment 17 Sebastien Pouliot 2016-12-22 14:25:28 UTC
1. MAC address should not be used, comment #10

2. It was the wrong interface being checked, comment #14