返回的mac地址对于不同的设备是相同的 [英] Returned mac-address is the same for different devices

查看:116
本文介绍了返回的mac地址对于不同的设备是相同的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在客户端应用程序中向服务器提供设备的唯一标识符. 在StackOverflow周围,通常建议使用该设备的mac地址,因为从iOS 5开始不推荐使用[[UIDevice currentDevice] uniqueIdentifier]属性.

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答案中提供的说明检索设备的mac地址时,两个设备都获得了相同的地址,这显然是错误的: 02:00:00: 00:00:00 .

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?

推荐答案

对不起,我不够专心. 在谈论这些设备时,我应该提到其中一个实际上是模拟器(具有 iOS 7 ),而另一个是具有 iOS 7 的设备. 所以现在我在

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:

在iOS 7和更高版本中,如果您要求提供iOS设备的MAC地址,系统将返回值02:00:00:00:00:00.如果需要标识设备,请改用UIDevice的identifierForVendor属性. (出于广告目的需要标识符的应用应考虑改用ASIdentifierManager的advertisingIdentifier属性.)

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.

这篇关于返回的mac地址对于不同的设备是相同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆