iPhone Unique Identifier


I have the problem that I'm trying to submit and retrieve user scores to my online database from within the game, I'm pretty sure I've got the actual submitting and retrieving sorted using the WWW class and some kind of XML parser using php pages residing on my domain. That bit seems relatively straight forward.

However, so as I can identify a returning user and specifically show their score I need some kind of identifier that is submitted with the score and the users' chosen display name. I know that all iPhones and iPod touches have a UDID but whilst searching out how to pull that from the iPhone all I can find are reports of games being rejected for using 'private APIs' and companies being accused of 'harvesting'.

Of course I'm not wanting to do anything frowned upon by Apple and I can understand why Apple and/or a user may not want to hand out their device's UDID.

I'm struggling to find answers or a workaround, I was thinking that if it's not possible to retrieve the UDID then maybe I could issue my own unique identifier the first time a user submits a score and then store that within the game so when they return their score can be updated correctly.

Either method has pro and cons that I have thought of already, for instance if I am able to get the UDID and use that method, then if a user sells their iPhone/iPod, even if the app is removed, if it is re-added by the new owner score records would be carried across, although not sensitive info it doesn't seem like good practice.

On the flip side, if I am able to generate and store my own unique ID on the device (which I have no idea how to do yet, but know must be possible or how else do games offer save functions) then if a user removes the app , then re-installs they lose their ability to update previous scores.

I'm thinking I could use username and passwords so a user could retrieve their unique ID that I previously generated for them, but I'm trying to create a pleasant user experience, that is suitable for all users, I don't want to have to worry about privacy policies or communicating why they even need a username/password!!

I've only been developing on iPhone for a few months and have not yet published anything to the store, so please consider me a noob, and apologies if this is stupid question! Any suggestions, knowledge of rules and Apple's policy would be greatly appreciated.

Many thanks in advance.



In writing this question it's made me think generating my own IDs is the way to go since user may upgrade their iPhone/iPod or get a replacement for any reason, and instead of username/password simply ask for an email address, through which they can retrieve their ID and re-input it themselves, still a little messy though! Obviously Facebook connect is an almost perfect solution but that can of worms will probably have to be saved for an update! Suggestions still very much welcome... Thank you!

You can use iPhoneSettings.uniqueIdentifier to get the device ID. It's not a private API.