CFUUIDRef in an ARC world


#1

For those using ARC, I believe the following method correctly/safely returns an NSString containing a UUID.

[code]- (NSString *)uuidString
{

CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFRelease(uuid);

return uuidStr;

}[/code]

You can then use this method on page 235 to set your possession’s new imageKey:

// Set new image key. Use helper method. [possession setImageKey:[self uuidString]];


#2

Worked for me. Thanks.