3

Hi I would like to generate an unique id for an iOS device using any of the device hardware parameters. I do not want to use the MAC address because there is a chance that the MAC address can also be changed. So can you please let me know if there is any other unique hardware parameter with which I can generate an unique ID.

Phaniteja
  • 131
  • 1
  • 7

1 Answers1

1

I believe something along the lines of this is the generally accepted replacement for UUID.

In short, you need to create a CFUUID, and then store it in the Keychain on the iOS device, which persists even if you uninstall the app. Having written my own implementation along those lines (not the one I've linked to, obviously), I've yet to come across any real problems with this. It can even be accessed in your other apps that you make, so long as you access it with the same security parameters in aloof your apps.

Community
  • 1
  • 1
CrimsonDiego
  • 3,616
  • 1
  • 23
  • 26
  • Thanks Crimson, that was a very useful piece of information. But CFUUID uses MAC address which can be changed. Are there any other device parameters which can be used so that I can write my own logic for the ID generation. – Phaniteja Jul 29 '12 at 20:06
  • You are not going to get a way to absolutely guarantee user tracking, because Apple removed the UUID. In creating the CFUUID, the MAC address is used, but it is not the only thing. If you create a CFUUID, and then create one again the next day, it will be different. The whole point of the CFUUID is that you can create it and then *store it in the keychain*. When you need it again, pull it out of the keychain. The keychain sticks around between even reinstalls, so its the best you are going to get. – CrimsonDiego Jul 30 '12 at 15:43
  • So is it safe to save the data in the keychain. – Phaniteja Jul 31 '12 at 13:35
  • Yes. The keychain is a persistant space that is specifically designed to store sensitive data. – CrimsonDiego Jul 31 '12 at 14:24