如何在iOS 6和iOS 7中获取UDID

How to get the UDID in iOS 6 and iOS 7

本问题已经有最佳答案,请猛点这里访问。

我想获取设备ID并将其发送到Web服务。我怎样才能在iOS 6中获得UDID

谢谢


由于安全/隐私原因,iOS 6+不再提供UDID。相反,使用identifierForVendoradvertisingIdentifier

供应商标识:

An alphanumeric string that uniquely identifies a device to the app’s
vendor. (read-only)

The value of this property is the same for apps that come from the
same vendor running on the same device. A different value is returned
for apps on the same device that come from different vendors, and for
apps on different devices regardless of vendor.

广告识别码:

An alphanumeric string unique to each device, used only for serving
advertisements. (read-only)

Unlike the identifierForVendor property of UIDevice, the same value is
returned to all vendors. This identifier may change—for example, if
the user erases the device—so you should not cache it.

这篇文章解释得很好。

另外,请参见苹果公司有关identifierForVendoradvertisingIdentifier的文档。


查看openudid:

OpenUDID is a drop-in replacement for the deprecated uniqueIdentifier property of the UIDevice class on iOS (a.k.a. UDID) and otherwise is an industry-friendly equivalent for iOS and Android, and most recently Windows C# and Silverlight (see links above).

编辑:请确保从2013年5月1日起,iOS 6将使用此分支,直到更新主目录: