Dev Juice: Help me generate unique identifiers
Dear Dev Juice,
Can you help me generate a unique identifier for my iOS apps? I don't want to rely on using UDIDs anymore. I'd say why but then you'd have to shoot me.
Watm-ever

Dear Watm-ever
That sounds dire. Let's avoid the violence and focus on the Core Foundation. Here you go. If you're not using ARC, then you'll need to autorelease uuidString rather than bridging.
You'll probably want to store your new ids into the keychain to allow them to persist.
Happy developing.
Update: Readers ask if this approach will persist between application reinstalls. Yes, as I originally posted, it will if you use the keychain. It will not persist with system re-installs if the keychain is wiped and not restored from a backup. Can you use the MAC address, yes -- but it looks as if Apple wants you to stay away from device-specific information.
Share
Source: http://tuaw.com/tag/devjuice
Add a Comment
A much more helpful link to generate your own GUID for the application, without privacy concerns: http://www.jayfuerstenberg.com/blog/overcoming-udid-deprecation-by-using-guids
August 30 2011 at 12:54 PM Report abuse Permalink rate up rate down ReplyBTW, has anyone read the license agreement on GitHub... Guy is asking for attribution on any advertising copy? Ridiculous.
August 30 2011 at 12:27 PM Report abuse Permalink rate up rate down ReplyHi.
Giving this solution, what if some user of our app, who had never backed up his/her device on iTunes, deletes it and then reinstall the app? This will generate another UDID. Let's say the app is based on exchanging information with a server. With this new UDID, the server recognizes him as a new user, so he is going to lose all of his past information. How to solve this?
Thanks a lot.
The point of using device-specific information is so you can aggregate and sell user information. It's much more useful if you can connect information across apps to a single device and build a profile connecting all of the user data and logs from all apps together.
This is, of course, a violation of privacy, and various lawsuits are pending as a result of the practice. Nonetheless, I predict that the MAC address will end up as the de facto replacement for the UUID.
Why is this even relevant to other iOS developers anymore? Apple killed UDID gathering via 3rd party applications in iOS 5...
August 22 2011 at 3:34 AM Report abuse Permalink rate up rate down ReplyThat's exactliy what the original question is about: If you can't use UDIDs anymore, how then can you generate unique identifiers? This Code generates a UUID, which is not bound to a specific hardware.
August 22 2011 at 9:00 AM Report abuse Permalink rate up rate down Reply[NSProcessInfo globallyUniqueString];
August 21 2011 at 11:25 PM Report abuse Permalink +1 rate up rate down ReplyGuys, don't diss Erica. This might not have been the best idea on her part for how she tried to solve this problem, but she's done a lot towards the Mac developer community and you should all be grateful.
On a side note, she contributed towards a nice piece of code that does a good job of doing this:
https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5
I don't understand the comments here. How can the fact of someone knowing a piece of information more than another person give them the right to be arrogant dicks?
August 21 2011 at 4:01 PM Report abuse Permalink +4 rate up rate down ReplyTragic job TUAW! Why don't you let people who can code handle these things for you?
https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5
There is no need to copy paste this code, it's awful. The author should be telling us that your UDID will be different every time your customer reinstalls the app. There are way more elegant solutions.
August 19 2011 at 10:15 PM Report abuse Permalink -2 rate up rate down ReplyDeals of the Day
more deals- Acoustic Research Digital Photo Frame with iPod Dock for $50 + free shipping
- Apple iPhone 4 8GB for Verizon, AT&T, or Sprint for $50 + pickup at Best Buy
- Unlocked iPhone 4S 16GB for GSM (AT&T, T-Mobile) for $619 + free shipping
- Apple iMac Core i7 Quad 3.4GHz 27" w/ 24GB RAM, 2TB HDD for $2,677 + $29 s&h
- Used Apple Magic Mouse for $36 + $4 s&h
- Skullcandy Riot Earbud Headphones for $10 + free shipping
18 Comments