Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mraheel

macrumors regular
Original poster
Apr 18, 2009
136
0
Hey guys,

I wanted to know more about this UUID for iOS.

UUID’s are 128-bit values which are guaranteed to be unique – typically the value is based on a machines ethernet address combined with the current time since October 15, 1582.
UUID’s are string values separated by hyphens, for example, here is how a UUID may look: 13222F23-C76A-7781-0C12-0293E3B34398.

I know some todo app that uses it as a task ID. perhaps suffixing it with their own tag or something.

I wanted to know what are the advantages of using such identifiers in SQLite instead of say a normal integer based / autoincrementing primarykey.

Apparently they are guaranteed to be unique, Can I trace a UUID to something? say date/time created or attach it to some device?

My intention is to use it in an app that has to do with Storage purposes using Sqlite and no, its not another todo app.

any any comment is appreciated. :)
 
I am not sure what is the real question here, but let's assume it was "what are the advantages of using such identifiers in SQLite instead of say a normal integer...?"

Well, for example this comes handy if you need to combine records from two or more sources into a single centralized database.
 
The UUID is unique for each device. Each device has one and only one and no other device has the same one.

I don't see why you would use it for a sqlite db on the device.

It is used by some to identify data sent from users to a server-based db. Some security professionals consider using the UUID in this manner to be an invasion of privacy. Many analytics and ad-servers etc do send the UUID off the device and use it as a unique identifier, behind the back of the user.
 
The UUID is unique for each device. Each device has one and only one and no other device has the same one.

UUID is a Universally Unique IDentifier. It's a generated value, and changes each time it's generated. It has a statistically low probability of being generated by another device, or at another time (practically unique).

UDID is the device's Unique Device IDentifier. It's a stored immutable value, that is always the same on each device, but different across devices (guaranteed unique). It's effectively the device's unique serial number.
 
There is no benefit in using a UUID or GUID as a key compared to an autoincrement integer.
 
Now I'm lost - are we talking about device id here or about the value returned by CFUUIDCreate() function? At first I was sure it's the later.

Code:
   CFUUIDRef    newUniqueID    = CFUUIDCreate (kCFAllocatorDefault);
   CFStringRef  newUniqueIDStr = CFUUIDCreateString (kCFAllocatorDefault, newUniqueID);
 
Thanks for the input guys.

@PhoneyDeveloper, I got you confused, i should have stressed it. I'm referring to UUID and not UDID as chown33 pointed out.

I don't see why you would use it for a sqlite db on the device.
I know a todo app that uses this UUID with a custom 5 letter suffix.
A UUID is assigned to each task created. Which can be shared via email with another app. They have pushnotification reminders etc.

This app kinda inspired me to ask the utility of UUID.

Im in the process of making similar app with enduser storage management using sqlitedb. Just wanted to make things "future proof" if and when i decide to add certain features. The presence of UUID should make things easier.

I have no clue as to what those features might be!
 
There is no benefit in using a UUID or GUID as a key compared to an autoincrement integer.

There is if you want the keys to be unique across devices, although I'm not sure if it's technically more efficient to use a regular integer as the primary key and have the UUID be another column that you only use when you need to find/compare things across devices.
 
although I'm not sure if it's technically more efficient to use a regular integer as the primary key and have the UUID be another column that you only use when you need to find/compare things across devices.

Thats what I wana find out. I guess it wouldnt be efficient. But how bad could it be?
And again, the benefit? apart from its uniqueness across devices; practically what are its applications?
 
There is no benefit in using a UUID or GUID as a key compared to an autoincrement integer.

This is untrue. The main point of UUIDs is the lack of a need to consult a central authority in order to generate an identifier. Each party can just make up their own whenever they need to. Sequential values, on the other hand, have to be coordinated. Now whether or not this capability is a benefit to a given system system depends on the needs of that system.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.