<?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>Shiny Things &#187; Cocoa</title>
	<atom:link href="http://www.andrewgrant.org/tag/cocoa/feed" rel="self" type="application/rss+xml" />
	<link>http://www.andrewgrant.org</link>
	<description>Andrew Grant</description>
	<lastBuildDate>Thu, 05 Jan 2012 09:52:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NSHTTPCookieOriginURL is broken on iOS :(</title>
		<link>http://www.andrewgrant.org/2011/04/20/nshttpcookieoriginurl-is-broken-on-ios.html</link>
		<comments>http://www.andrewgrant.org/2011/04/20/nshttpcookieoriginurl-is-broken-on-ios.html#comments</comments>
		<pubDate>Thu, 21 Apr 2011 04:59:08 +0000</pubDate>
		<dc:creator>agrant</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://www.andrewgrant.org/?p=496</guid>
		<description><![CDATA[A quick tip that might save someone a good few hours of bug hunting: Under iOS it seems that when creating cookies via [NSHTTPCookie cookieWithProperties] that using NSHTTPCookieOriginURL will cause creation to fail. Instead you should pass the URL as &#8230; <a href="http://www.andrewgrant.org/2011/04/20/nshttpcookieoriginurl-is-broken-on-ios.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A quick tip that might save someone a good few hours of bug hunting:</p>
<p>Under iOS it seems that when creating cookies via [NSHTTPCookie cookieWithProperties] that using NSHTTPCookieOriginURL will cause creation to fail. Instead you should pass the URL as two parts using CookieDomain and CookiePath.</p>
<p>E.g this will silently fail:</p>
<div class="codecolorer-container objc dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSHTTPCookieStorage</span> sharedHTTPCookieStorage<span style="color: #002200;">&#93;</span> setCookie<span style="color: #002200;">:</span><br />
&nbsp; <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSHTTPCookie</span> cookieWithProperties<span style="color: #002200;">:</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithObjectsAndKeys<span style="color: #002200;">:</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Name&quot;</span>, NSHTTPCookieName, &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Value&quot;</span>, NSHTTPCookieValue, <br />
&nbsp; &nbsp; &nbsp; referringUrl, NSHTTPCookieOriginURL, <br />
&nbsp; &nbsp; &nbsp; <span style="color: #a61390;">nil</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#93;</span><br />
&nbsp; <span style="color: #002200;">&#93;</span><br />
<span style="color: #002200;">&#93;</span>;</div></div>
<p>But this will work (referringUrl is an NSURL such as http://example.com/foo/bar)</p>
<div class="codecolorer-container objc dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #400080;">NSHTTPCookie</span><span style="color: #002200;">*</span> cookie <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSHTTPCookie</span> cookieWithProperties<span style="color: #002200;">:</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithObjectsAndKeys<span style="color: #002200;">:</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Name&quot;</span>, NSHTTPCookieName, &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Value&quot;</span>, NSHTTPCookieValue, <br />
&nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>referringUrl host<span style="color: #002200;">&#93;</span>, NSHTTPCookieDomain, <br />
&nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>referringUrl path<span style="color: #002200;">&#93;</span>, NSHTTPCookiePath,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #a61390;">nil</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#93;</span><br />
&nbsp; <span style="color: #002200;">&#93;</span>;&nbsp; &nbsp; <br />
CBD_ASSERT<span style="color: #002200;">&#40;</span>cookie<span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSHTTPCookieStorage</span> sharedHTTPCookieStorage<span style="color: #002200;">&#93;</span> setCookie<span style="color: #002200;">:</span>cookie<span style="color: #002200;">&#93;</span>;</div></div>
<p>And you can see, this time there&#8217;s a handy assert to catch any problems early on. Sometimes it pays to break your code into multiple statements even when not strictly necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrewgrant.org/2011/04/20/nshttpcookieoriginurl-is-broken-on-ios.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Best iPhone Programming Book</title>
		<link>http://www.andrewgrant.org/2008/08/04/the-best-iphone-programming-book.html</link>
		<comments>http://www.andrewgrant.org/2008/08/04/the-best-iphone-programming-book.html#comments</comments>
		<pubDate>Tue, 05 Aug 2008 01:21:04 +0000</pubDate>
		<dc:creator>agrant</dc:creator>
				<category><![CDATA[Distractions]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.andrewgrant.org/2008/08/04/the-best-iphone-programming-book.html</guid>
		<description><![CDATA[If you want a book that offers a quick way to get up to speed on the iPhone, and that serves as a great reference to both Objective-C and Cocoa, then look no further. <a href="http://www.andrewgrant.org/2008/08/04/the-best-iphone-programming-book.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img title="image1" style="display: inline; margin-left: 0px; margin-right: 0px" height="160" alt="image1" src="http://www.andrewgrant.org/wordpress/wp-content/uploads/2008/10/image1.jpg" width="121" align="right" /> </p>
<p><a href="http://www.amazon.com/gp/product/0321503619?ie=UTF8&amp;tag=shinthin-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321503619">Cocoa Programming for Mac OS X (3rd Edition)</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=shinthin-20&amp;l=as2&amp;o=1&amp;a=0321503619" width="1" border="0" /></p>
<p>Due to the stringent SDK NDA there are no &quot;Programming for the iPhone&quot; type books currently available. However that are still plenty of books that can teach you how to program the iPhone.</p>
<p>Because the iPhone SDK is built upon the Cocoa foundation framework, and the iPhone UIKit framework is heavily influenced by the regular OSX AppKit, many of the same principles apply. In addition the tools used to create regular Mac apps are the same as used for the iPhone.</p>
<p>If you want a book that offers a quick way to get up to speed on the iPhone, and that serves as a great reference to both Objective-C and Cocoa, then look no further. This book&#8217;s extremely readable and you can pickup a lot without writing every sample. Being new to XCode / Interface Builder I also found some of the workflow tips to be extremely helpful. Single-pane all the way!</p>
<p>This book definitely helped me get to grips with Objective-C / Cocoa (some areas of which I still find just odd, but more on those later). If/when the NDA restrictions are lifted I wouldn&#8217;t be surprised if this is still a better starting guide for iPhone programming than some of the dedicated books.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrewgrant.org/2008/08/04/the-best-iphone-programming-book.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

