Skip to content

Instantly share code, notes, and snippets.

@acrist
Forked from cuberoot/NSString+UUID.h
Created August 8, 2011 21:47
Show Gist options
  • Save acrist/1132840 to your computer and use it in GitHub Desktop.
Save acrist/1132840 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface NSString (UUID)
+ (NSString*)stringWithUUID;
@end
#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