I have to provide the unique identifier of my device to the server in a client app.
Around StackOverflow it's been recommended commonly to use the device's mac address, since [[UIDevice currentDevice] uniqueIdentifier]
property is deprecated started from iOS 5.
So, when I make attempt to retrieve a device's mac address following the instructions, provided in the answers around SO, I get the same address for both my devices, which is obviously wrong: 02:00:00:00:00:00.
Checked the code many times, but it seems to be correct. What could cause the problem of this sort?
Sorry guys, I was not attentive enough. When I was talking about the devices, I should mention that one of them was actually a simulator (with iOS 7), and the other was a device with iOS 7. So now I've found in the Apple documentation, that:
In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value 02:00:00:00:00:00. If you need to identify the device, use the identifierForVendor property of UIDevice instead. (Apps that need an identifier for their own advertising purposes should consider using the advertisingIdentifier property of ASIdentifierManager instead.)
So, identifierForVendor is exactly what I wanted. It's a pity though, that now in the code a developer should sort out different iOS versions support even for that thing.
Have a look at this link eliminates-mac-address-as-tracking-option-signaling-final-push-towards-apples-own-ad-identifier-technology
According to this
“The MAC address, a hardware based identifier, has long been a way for advertisers to have a permanent, unique identifier for each device, providing a stable tracking option as an alternative to the controversy-plagued UDID,” Palli explains. “However, the same privacy concerns raised about the UDID apply equally to the MAC address – it just received less publicity,” he adds. Now, for those who haven’t yet made the switch to IDFA, the window to migrate is closing.
According to data collected by mobile app marketing firm Fiksu, which helps app publishers with user acquisition efforts, iOS 7 devices – all beta testers, at this point – are always now returning a MAC address of 02:00:00:00:00:00. This “dummy” address is the equivalent of the phone number 555-1212, for example. It began showing up for the tens of thousands of unique iOS 7 devices in Fiksu’s logs earlier this week, says Craig Palli, Fiksu’s mobile app marketing technology platform head.
please use following link for UDID , because you can not use directly by first may 2013 https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5/tree/master/UIDeviceAddition
来源:https://stackoverflow.com/questions/17082738/returned-mac-address-is-the-same-for-different-devices