ios 如何唯一标识iOS设备而不是使用UUID和UDID

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30936371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 06:30:34  来源:igfitidea点击:

How to identify iOS device uniquely instead of using UUID and UDID

iosuuiduniqueidentifierudid

提问by Kirti Nikam

In my iOS app, I have to restrict the user to use iOS app per device. To do this I found a solution that we can use the UUID (Universally Unique Identifier)or UDID (Unique Device Identifier). But according to this answerI can't use UUID, because if app gets deleted or reinstalled UUIDhas been getting changed and I don't want this. Also Apple rejects apps if app uses UDID.

在我的 iOS 应用程序中,我必须限制用户在每台设备上使用 iOS 应用程序。为此,我找到了一个解决方案,我们可以使用UUID (Universally Unique Identifier)or UDID (Unique Device Identifier)。但是根据this answer我不能使用UUID,因为如果应用程序被删除或重新安装UUID已经被更改,我不想要这个。如果应用程序使用UDID.

Is there any way to identify iOS device uniquely.

有什么方法可以唯一标识iOS设备。

回答by Vijay Tholpadi

Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification. Source: TNW

Apple 已经废除了 UDID 的方法,并将拒绝使用相同的应用程序进行唯一设备标识。资料来源:TNW

What you are looking for is Vendor ID

您正在寻找的是供应商 ID

回答by mgyky

I'm using this library for my projects, and it's working like a charm, please try :

我正在将这个库用于我的项目,它的工作非常吸引人,请尝试:

https://github.com/blackpixel/BPXLUUIDHandler

https://github.com/blackpixel/BPXLUUIDHandler

easy to use :

便于使用 :

Import BPXLUUIDHandler.h Retrieve the UUID with

导入 BPXLUUIDHandler.h 检索 UUID

[BPXLUUIDHandler UUID]

Thats all...

就这样...

Here is some info from project's github page :

以下是来自项目 github 页面的一些信息:

As of iOS 5, Apple has deprecated the device unique identifier api and hasn't provided a friendly Obj-C replacement, instead recommending CFUUIDCreate and NSUserDefaults.

CFUUIDCreate isn't very complicated and neither is NSUserDefaults, but this solution fails in a few different ways:

  • It's not a quick one-shot call to get the UUID; you have to write your own wrapper to make it friendly
  • It doesn't persist; deleting the app blows away the UUID (can be persisted if stored in the keychain though)
  • There's no way to share it between apps

从 iOS 5 开始,Apple 已弃用设备唯一标识符 api 并且没有提供友好的 Obj-C 替代品,而是推荐 CFUUIDCreate 和 NSUserDefaults。

CFUUIDCreate 和 NSUserDefaults 都不是很复杂,但是这个解决方案在几个不同的方面失败了:

  • 获取 UUID 不是一次性的快速调用;您必须编写自己的包装器以使其友好
  • 它不会持续存在;删除应用程序会清除 UUID(如果存储在钥匙串中,则可以保留)
  • 无法在应用程序之间共享它