I’m writting an application for iphone, which communicates with my server using REST. The main problem is, I need to identify user somehow. Not so long ago, we were allowed to use UDID, but now its not allowed anymore. So what should I use instead? I need some kind of identifier on iphone, so user will delete application, install it again, and he will get same id.
I’m writting an application for iphone, which communicates with my server using REST. The
Share
Firstly, the UDID is only deprecated in iOS 5. That doesn’t mean it’s gone (yet).
Secondly, you should ask yourself if you really need such a thing. What if the user gets a new device and installs your app on that? Same user, but the UDID has changed. Meanwhile, the original user might have sold his old device so now a completely new user installs your app and you think it’s a different person based on the UDID.
If you don’t need the UDID, use
CFUUIDCreate()to create a unique ID and save it to the user defaults on the first launch (useCFUUIDCreateString()to convert the UUID to a string first). It will survive backups and restores and even come along with the original user when they switch to a new device. It’s in many ways a better option that the UDID.If you really need a unique device identifier (it doesn’t sound like you do), go for the MAC address as pointed out in Suhail’s answer.