问题
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