Reputation: 1613
I can get UUID string using below code ..
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
Or I can get bytes using below code
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFUUIDBytes bytes = CFUUIDGetUUIDBytes(theUUID);
But I would like to make an array of UInt8 and as the UUID is 16 bytes, so the output array should be in 16 bytes.
Upvotes: 1
Views: 1053
Reputation: 41632
By examining the CFUUIDBytes typedef you can see how to access each byte:
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFUUIDBytes bytes = CFUUIDGetUUIDBytes(theUUID);
UInt8 rawData[16];
rawData[0] = bytes.byte0;
rawData[1] = bytes.byte1;
...
rawData[15] = bytes.byte15;
Upvotes: 2