Created
July 22, 2010 23:06
-
-
Save cuberoot/486765 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSString (UUID) | |
+ (NSString*)stringWithUUID; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSString+UUID.h" | |
@implementation NSString (UUID) | |
+ (NSString*)stringWithUUID | |
{ | |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); | |
NSString * string = (NSString*)CFMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, uuid)); | |
CFRelease(uuid); | |
return [string autorelease]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For an ARC compatible implementation: https://gist.github.com/1501325
Although this is a method, not an extension to NSString.