<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vincent Gable's Blog &#187; Categories</title>
	<atom:link href="http://vgable.com/blog/tag/categories/feed/" rel="self" type="application/rss+xml" />
	<link>http://vgable.com/blog</link>
	<description>my weblog.</description>
	<lastBuildDate>Tue, 29 Nov 2011 22:20:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>UUID (GUID) Support in Cocoa</title>
		<link>http://vgable.com/blog/2008/02/24/creating-a-uuid-guid-in-cocoa/</link>
		<comments>http://vgable.com/blog/2008/02/24/creating-a-uuid-guid-in-cocoa/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 22:28:08 +0000</pubDate>
		<dc:creator>Vincent Gable</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Categories]]></category>
		<category><![CDATA[GUID]]></category>
		<category><![CDATA[UUID]]></category>

		<guid isPermaLink="false">http://vgable.com/blog/2008/02/24/creating-a-uuid-guid-in-cocoa/</guid>
		<description><![CDATA[To easily create a new UUID (aka GUID) in Cocoa, add the following method as a category to NSString: + (NSString*) stringWithUUID { &#160;&#160;&#160;CFUUIDRef uuidObj = CFUUIDCreate(nil);//create a new UUID &#160;&#160;&#160;//get the string representation of the UUID &#160;&#160;&#160;NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj); &#160;&#160;&#160;CFRelease(uuidObj); &#160;&#160;&#160;return [uuidString autorelease]; } That&#8217;s it, just 4 lines of code. There&#8217;s really [...]]]></description>
			<content:encoded><![CDATA[<p>To easily create a new <a href="http://www.faqs.org/rfcs/rfc4122.html">UUID</a> (aka <a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier">GUID</a>) in Cocoa, add the following method as a category to NSString:</p>
<p><code>+ (NSString*) stringWithUUID {<br />
&nbsp;&nbsp;&nbsp;CFUUIDRef	uuidObj = CFUUIDCreate(nil);//create a new UUID<br />
&nbsp;&nbsp;&nbsp;//get the string representation of the UUID<br />
&nbsp;&nbsp;&nbsp;NSString	*uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj);<br />
&nbsp;&nbsp;&nbsp;CFRelease(uuidObj);<br />
&nbsp;&nbsp;&nbsp;return [uuidString autorelease];<br />
}</code></p>
<p>That&#8217;s it, just 4 lines of code. There&#8217;s really no need to deal with an entire UUID <i>class</i>. All you ever need to do with UUIDs is create them, compare them, and store/retrieve them.  <code>+ stringWithUUID</code> handles creation.  The string it returns responds to <code> - isEqual:</code>, and is easy to write or read using the mature Foundation APIs.  What more could you ask for from a UUID object?</p>
<h3>Simpler Ways:</h3>
<p>You might only need:<code> [[NSProcessInfo processInfo] globallyUniqueString]</code>.  As the name implies, it gives you a UUID that can be used to identify a process.</p>
<p>
If you want a UUID without messing with compiled code, the <a href="x-man-page://uuidgen"><code>uuidgen</code></a> command-line tool generates them, or you can use <a href="http://www.famkruithof.net/uuid/uuidgen">this website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://vgable.com/blog/2008/02/24/creating-a-uuid-guid-in-cocoa/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

