Back to Mobile View

Skip to Content

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.



 

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

18 Comments

Filter by:
sj614870

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 rate up rate down Reply
sj614870

BTW, 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 rate up rate down Reply
guirto

Hi.

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.

August 22 2011 at 5:41 PM Report abuse rate up rate down Reply
partner

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.

August 22 2011 at 3:16 PM Report abuse rate up rate down Reply
Alan

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 rate up rate down Reply
1 reply to Alan's comment
Stefan

That'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 rate up rate down Reply
Rudy Richter

[NSProcessInfo globallyUniqueString];

August 21 2011 at 11:25 PM Report abuse +1 rate up rate down Reply
Unknown

Guys, 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

August 21 2011 at 5:40 PM Report abuse +2 rate up rate down Reply
jamesnigels

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 +4 rate up rate down Reply
tigermark2010

Tragic 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

August 21 2011 at 2:35 PM Report abuse -4 rate up rate down Reply
4 replies to tigermark2010's comment
Boris Ioffe

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 -2 rate up rate down Reply
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.