You need a "bridge":
+ (NSString *)GetUUID { CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); return (__bridge_transfer NSString *)string; }
Transition to ARC Guide says
__bridge_transfer or CFBridgingRelease() moves the non-Objective-C pointer to Objective-C, and also transfers ownership of the ARC.
But! You must also rename your method. ARC uses method naming conventions to determine hold values, and methods starting with get in Cocoa have a specific meaning of passing a buffer to fill data. The best name would be buildUUID or another word that describes the use of UUID: pizzaUUID or bearUUID .
Josh caswell
source share