How unique are the ids generated with CFUUID , in iOS?

狂风中的少年 提交于 2019-12-19 04:09:21

问题


The title is my question actually. Now that Apple doesnt allow any more the use of UUID i decided to go with the CFUUID.

However i have some questions regarding it.

Is is unique for every device? If yes how is it different from UUID?

Is it a random generator? If yes how good is it? Can i be sure that in 10000 devices there wont be a duplicate?

I am between in this solution of using CFUUID , and having my server generating a random unique identifier that i can be sure of. However this would need unnecessary coding and http requests between the server and the devices.

Any ideas?


回答1:


When you say that apple doesn't allow the use of UUID, you must be referring to the UDID, or Unique Device ID.

A UUID is unique every time you generate one. It's not simply a UDID. UUIDs are unique globally.

Is it unique for every device? If yes how is it different from UDID?

Yes, it's unique for every device because part of a UUID is a devide ID, though it's not the entire UDID. The UDID is always the same. Each time you create a UUID, it's different from the last, so you would need to store the UUID if you wanted to use it as a device ID.

Is it a random generator? If yes how good is it? Can i be sure that in 10000 devices there wont be a duplicate?

A UUID is computed, not randomly generated. The first part is a form of device ID, and the second part is derived from the date and time. While the date and time part of a UUID may be duplicated between devices, the device ID portion still guarantees unique UUIDs globally.




回答2:


If every person in the world has 600,000,000 iOS devices each, and all of them install your app on every device, then there is a 50% chance that two devices somewhere will generate the same UUID.

http://en.wikipedia.org/wiki/Universally_unique_identifier#Random_UUID_probability_of_duplicates



来源:https://stackoverflow.com/questions/16461079/how-unique-are-the-ids-generated-with-cfuuid-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!