How do we get unique IDs in Objective C. I want to create a unique ID for my session & then generate a ID each time a server call happens. Each time this ID should be unique.
I tried using CFUUID class which gives us a huge unique ID (4FE9D00C-531E-45E8-B10E-11968ACC36E9). I want a unique ID of smaller size.
Any clue?
A guid (by shear combinations) generates a unique id. If it’s less characters you want then one option is to base64encode the guid. That allows for 64 possibilities per char instead of 16 (0-9, A-F)
This:
Becomes:
For example: (C# though) http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx
Here’s a SO post on objective-c encode/decode (look @ Mike Ho post):
How do I do base64 encoding on iphone-sdk?