5
MAR
2011

UUID Category

Here's an NSString category for creating UUID strings that might come in handy. As always, you can do whatever you want with code that I put on this blog, but I take no responsibility for it or what you do with it. :-)

Header file (UUID.h):

#import <Foundation/Foundation.h>
 
@interface NSString (UUID)
 
+ (NSString *)stringWithUUID;
 
@end

Implementation file (UUID.m):

#import "UUID.h"
 
@implementation NSString (UUID)
 
+ (NSString *)stringWithUUID
{
    CFUUIDRef uuidObject = CFUUIDCreate(nil);
    NSString *uuidString = (NSString *)CFUUIDCreateString(nil, uuidObject);
    CFRelease(uuidObject);
    return [uuidString autorelease];
}
 
@end


 
Name:





CAPTCHA Image
Reload Image
(Surround code with --code-- and --/code--)


Comments are subject to review and will not be shown until they have been approved, for the purpose of keeping spammers and morons away.


 
Comment awaiting approval.


About This Site

Hello, my name is Martin Johannesson and this is my home on the web. I live in Stockholm, Sweden, where I work as a software engineer at a software company.

Ever since I was a kid and discovered the art of programming on my C64, I've been tinkering with my own little software projects and experiments. This site is one such experiment.
more...

Recent Entries RSS Feed

Tags

Amiga blog C Cocoa game GLGX GLSL iOS iPad iPhone Java jQuery Mac Mac OS X Objective-C OpenAL OpenGL Programming REBOL Shaders Vertex Shader web

Blog Archive

2011: 01 02 03 04 05 06 07 08 09 10 11 12
2010: 01 02 03 04 05 06 07 08 09 10 11 12
2009: 01 02 03 04 05 06 07 08 09 10 11 12

Random Images Load new images

loading
loading
loading
loading
loading
loading
loading
loading
loading
loading
loading
loading