DonP
DonP

Reputation: 777

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

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?

Upvotes: 3

Views: 4207

Answers (2)

Abhi Beckert
Abhi Beckert

Reputation: 33359

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

Upvotes: 1

Marcus Adams
Marcus Adams

Reputation: 53830

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.

Upvotes: 10

Related Questions