Get The UUID From The iPhone – Programmatically

UUID is an immutable representation of a 128-bit universally unique identifier (UUID).

it support only ios 6.0 and above

NSUUID *deviceId;
deviceId = [NSUUID initWithUUIDString:@"UUID-STRING-VALUE"];
deviceId = [UIDevice currentDevice].identifierForVendor;

ios 5 to use like

 if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
    // This is will run if it is iOS6
    return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
   // This is will run before iOS6 and you can use openUDID or other 
   // method to generate an identifier