<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
 	<channel>
		<title>Grokking Cocoa</title>
		<link>http://www.grokkingcocoa.com/</link>
		<description></description>
		<language>en</language>
		<lastBuildDate>Thu, 05 May 2016 16:18:56 -0700</lastBuildDate>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>Sandvox 2.10.6</generator>
		<item>
			<title>An AppleScript to bring the iOS Simulator to the foreground</title>
			<link>http://www.grokkingcocoa.com/an-applescript-to-bring-the.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;I use &lt;a href="https://www.boastr.net/"&gt;BetterTouchTool&lt;/a&gt; to bind apps to shortcut keys (similar to the way &lt;a href="http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/"&gt;Brett Terpstra&lt;/a&gt; does). For example, pressing ⌘⌥⌃⇧-X brings up Xcode. Actually I have ⌘⌥⌃⇧ bound to the &lt;a href="http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/"&gt;caps lock key&lt;/a&gt;. This way I can press caps lock-X to bring up Xcode. I have my most common apps bound to shortcut keys. I rarely use ⌘-tab now. Much faster.&lt;/p&gt;&lt;p&gt;I used to have the caps lock bound to the control key, but having an app switcher/system key has been much more useful on the Mac.&lt;/p&gt;&lt;p&gt;I wanted to be able to bind the iOS Simulator to a key, but there are several simulators and Xcode versions on machine. Every time I would try to bind a key to the Simulator a different Simulator would pop up. So I created the below AppleScript to bring the Simulator to the foreground.&lt;/p&gt;
					
					&lt;div class="first wide center"&gt;
						&lt;div style="" class="graphic"&gt;
							&lt;div class="figure-content HTMLElement"&gt;
								&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gc_class_k"&gt;tell&lt;/span&gt; &lt;span class="gc_class_nb"&gt;application&lt;/span&gt; &lt;span class="gc_class_s2"&gt;&amp;quot;System Events&amp;quot;&lt;/span&gt;
  &lt;span class="gc_class_k"&gt;set&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theProcesses&lt;/span&gt; &lt;span class="gc_class_k"&gt;to&lt;/span&gt; &lt;span class="gc_class_nb"&gt;application&lt;/span&gt; &lt;span class="gc_class_nv"&gt;processes&lt;/span&gt;
  &lt;span class="gc_class_k"&gt;repeat&lt;/span&gt; &lt;span class="gc_class_nv"&gt;with&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theProcess&lt;/span&gt; &lt;span class="gc_class_k"&gt;from&lt;/span&gt; &lt;span class="gc_class_mi"&gt;1&lt;/span&gt; &lt;span class="gc_class_k"&gt;to&lt;/span&gt; &lt;span class="gc_class_nb"&gt;count&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theProcesses&lt;/span&gt;
    &lt;span class="gc_class_k"&gt;set&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theName&lt;/span&gt; &lt;span class="gc_class_k"&gt;to&lt;/span&gt; &lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_na"&gt;name&lt;/span&gt; &lt;span class="gc_class_k"&gt;of&lt;/span&gt; &lt;span class="gc_class_nv"&gt;process&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theProcess&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;
    &lt;span class="gc_class_k"&gt;if&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theName&lt;/span&gt; &lt;span class="gc_class_ow"&gt;contains&lt;/span&gt; &lt;span class="gc_class_s2"&gt;&amp;quot;Simulator&amp;quot;&lt;/span&gt; &lt;span class="gc_class_k"&gt;then&lt;/span&gt;
      &lt;span class="gc_class_k"&gt;tell&lt;/span&gt; &lt;span class="gc_class_nv"&gt;process&lt;/span&gt; &lt;span class="gc_class_nv"&gt;theProcess&lt;/span&gt;
        &lt;span class="gc_class_k"&gt;set&lt;/span&gt; &lt;span class="gc_class_nb"&gt;the&lt;/span&gt; &lt;span class="gc_class_na"&gt;frontmost&lt;/span&gt; &lt;span class="gc_class_k"&gt;to&lt;/span&gt; &lt;span class="gc_class_no"&gt;true&lt;/span&gt;
      &lt;span class="gc_class_k"&gt;end&lt;/span&gt; &lt;span class="gc_class_k"&gt;tell&lt;/span&gt;
    &lt;span class="gc_class_k"&gt;end&lt;/span&gt; &lt;span class="gc_class_k"&gt;if&lt;/span&gt;
  &lt;span class="gc_class_k"&gt;end&lt;/span&gt; &lt;span class="gc_class_k"&gt;repeat&lt;/span&gt;
&lt;span class="gc_class_k"&gt;end&lt;/span&gt; &lt;span class="gc_class_k"&gt;tell&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
							&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
					
				&lt;/div&gt;
			</description>
			<pubDate>Thu, 05 May 2016 15:41:33 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/an-applescript-to-bring-the.html</guid>
            
			
		</item>
		<item>
			<title>How to display WebP images on iOS using Swift</title>
			<link>http://www.grokkingcocoa.com/how-to-display-webp-images.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;strong&gt;Build the WebP framework&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;You can get a &lt;a href="https://github.com/carsonmcdonald/WebP-iOS-example"&gt;script&lt;/a&gt; to build the WebP framework from &lt;a href="https://github.com/carsonmcdonald/WebP-iOS-example"&gt;Carson McDonald&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Change the script to use the latest stable version of the WebP code. Download the &lt;a href="https://developers.google.com/speed/webp/download"&gt;source code of WebP library&lt;/a&gt; as a tar.gz file (it is what the scrip;t requires). The download link is near the middle of the page.  Run the script and place the resulting framework into your project.&lt;/p&gt;&lt;p&gt;Even though it is easy to compile the WebP library, the script is nice in that it compiles all the libraries needed for each iOS platform and the simulator and puts it all in a nice framework for you. Awesome job Carson.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;strong&gt;Add the WebP Header to your bridging header&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
					&lt;div class="first wide center"&gt;
						&lt;div style="" class="graphic"&gt;
							&lt;div class="figure-content HTMLElement"&gt;
								&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;    &lt;span class="gc_class_p"&gt;#&lt;/span&gt;&lt;span class="gc_class_kd"&gt;import&lt;/span&gt; &lt;span class="gc_class_s"&gt;&amp;quot;WebP/decode.h”&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
							&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You can create a bridging header by creating a header file in your project (select File/New/File in Xcode’s menu,  select  iOS/Sources and the  &lt;em&gt;Heder File&lt;/em&gt;&lt;span style="font-family: Georgia;"&gt; icon, hit Next, then name it and Create it).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Georgia;"&gt;In the projects build setting for your target, add the path to your header file. Edit the &lt;/span&gt;&lt;em style="font-family: Georgia;"&gt;Objective-C Bridging Header&lt;/em&gt;&lt;span style="font-family: Georgia;"&gt; field (search on bridg 😄) , add the path of the header (e.g. &lt;/span&gt;DisplayWebP/DisplayWebP-Bridging-Header.h).&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;strong&gt;Here’s the swift code you are looknig for:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
					
					&lt;div class="not-first-item wide center"&gt;
						&lt;div style="" class="graphic"&gt;
							&lt;div class="figure-content HTMLElement"&gt;
								&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gc_class_kd"&gt;import&lt;/span&gt; &lt;span class="gc_class_nc"&gt;UIKit&lt;/span&gt;

&lt;span class="gc_class_kd"&gt;private&lt;/span&gt; &lt;span class="gc_class_kd"&gt;func&lt;/span&gt; &lt;span class="gc_class_nf"&gt;freeImageData&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;info&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_nb"&gt;UnsafeMutablePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;Void&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;,&lt;/span&gt; &lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_nb"&gt;UnsafePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;Void&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;,&lt;/span&gt; &lt;span class="gc_class_n"&gt;size&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
    &lt;span class="gc_class_n"&gt;free&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_nb"&gt;UnsafeMutablePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;Void&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;))&lt;/span&gt;
&lt;span class="gc_class_p"&gt;}&lt;/span&gt;

&lt;span class="gc_class_kd"&gt;extension&lt;/span&gt; &lt;span class="gc_class_bp"&gt;UIImage&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
    &lt;span class="gc_class_kd"&gt;class&lt;/span&gt; &lt;span class="gc_class_nc"&gt;func&lt;/span&gt; &lt;span class="gc_class_n"&gt;imageFromWebPData&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;imagData&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_bp"&gt;NSData&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt; &lt;span class="gc_class_p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="gc_class_bp"&gt;UIImage&lt;/span&gt;&lt;span class="gc_class_p"&gt;?&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
        &lt;span class="gc_class_kd"&gt;var&lt;/span&gt; &lt;span class="gc_class_nv"&gt;width&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int32&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_mi"&gt;0&lt;/span&gt;
        &lt;span class="gc_class_kd"&gt;var&lt;/span&gt; &lt;span class="gc_class_nv"&gt;height&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int32&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_mi"&gt;0&lt;/span&gt;

        &lt;span class="gc_class_k"&gt;if&lt;/span&gt; &lt;span class="gc_class_n"&gt;WebPGetInfo&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_nb"&gt;UnsafePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;UInt8&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;imagData&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;bytes&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_n"&gt;imagData&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;length&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="gc_class_n"&gt;width&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="gc_class_n"&gt;height&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt; &lt;span class="gc_class_p"&gt;==&lt;/span&gt; &lt;span class="gc_class_mi"&gt;0&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
            &lt;span class="gc_class_k"&gt;return&lt;/span&gt; &lt;span class="gc_class_kc"&gt;nil&lt;/span&gt;
        &lt;span class="gc_class_p"&gt;}&lt;/span&gt;
        &lt;span class="gc_class_kd"&gt;let&lt;/span&gt; &lt;span class="gc_class_nv"&gt;data&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_n"&gt;WebPDecodeRGBA&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_nb"&gt;UnsafePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;UInt8&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;imagData&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;bytes&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_n"&gt;imagData&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;length&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="gc_class_n"&gt;width&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="gc_class_n"&gt;height&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;

        &lt;span class="gc_class_kd"&gt;let&lt;/span&gt; &lt;span class="gc_class_nv"&gt;provider&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGDataProviderCreateWithData&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_kc"&gt;nil&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_nb"&gt;UnsafePointer&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="gc_class_nb"&gt;Void&lt;/span&gt;&lt;span class="gc_class_p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;width&lt;/span&gt; &lt;span class="gc_class_o"&gt;*&lt;/span&gt; &lt;span class="gc_class_n"&gt;height&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt; &lt;span class="gc_class_o"&gt;*&lt;/span&gt; &lt;span class="gc_class_mi"&gt;4&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_n"&gt;freeImageData&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;
        &lt;span class="gc_class_kd"&gt;let&lt;/span&gt; &lt;span class="gc_class_nv"&gt;colorSpaceRef&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGColorSpaceCreateDeviceRGB&lt;/span&gt;&lt;span class="gc_class_p"&gt;()&lt;/span&gt;

        &lt;span class="gc_class_kd"&gt;let&lt;/span&gt; &lt;span class="gc_class_nv"&gt;bi&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGBitmapInfo&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;rawValue&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGBitmapInfo&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;ByteOrderDefault&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;rawValue&lt;/span&gt; &lt;span class="gc_class_o"&gt;|&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGImageAlphaInfo&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;Last&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;rawValue&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;

        &lt;span class="gc_class_kd"&gt;let&lt;/span&gt; &lt;span class="gc_class_nv"&gt;imageRef&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_n"&gt;CGImageCreate&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_nb"&gt;Int&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;width&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;height&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_mi"&gt;8&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_mi"&gt;32&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_mi"&gt;4&lt;/span&gt; &lt;span class="gc_class_o"&gt;*&lt;/span&gt; &lt;span class="gc_class_nb"&gt;Int&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;width&lt;/span&gt;&lt;span class="gc_class_p"&gt;),&lt;/span&gt; &lt;span class="gc_class_n"&gt;colorSpaceRef&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_n"&gt;bi&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_n"&gt;provider&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_kc"&gt;nil&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_kc"&gt;true&lt;/span&gt;&lt;span class="gc_class_p"&gt;,&lt;/span&gt; &lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;RenderingIntentDefault&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;
        &lt;span class="gc_class_k"&gt;if&lt;/span&gt; &lt;span class="gc_class_n"&gt;imageRef&lt;/span&gt; &lt;span class="gc_class_p"&gt;==&lt;/span&gt; &lt;span class="gc_class_kc"&gt;nil&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
            &lt;span class="gc_class_k"&gt;return&lt;/span&gt; &lt;span class="gc_class_kc"&gt;nil&lt;/span&gt;
        &lt;span class="gc_class_p"&gt;}&lt;/span&gt;
        &lt;span class="gc_class_k"&gt;return&lt;/span&gt; &lt;span class="gc_class_bp"&gt;UIImage&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_bp"&gt;CGImage&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_n"&gt;imageRef&lt;/span&gt;&lt;span class="gc_class_p"&gt;!)&lt;/span&gt;
    &lt;span class="gc_class_p"&gt;}&lt;/span&gt;
&lt;span class="gc_class_p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
							&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;To decode a WebP image it is basically two lines: get the image info and then decode. Everything after the WebPDecodeRGBA function is to convert the decoded raw memory to an UIImage.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Georgia;"&gt;I typically use it after downloading an image using the resulting NSData:&lt;/span&gt;&lt;/p&gt;
					
					&lt;div class="not-first-item wide center"&gt;
						&lt;div style="" class="graphic"&gt;
							&lt;div class="figure-content HTMLElement"&gt;
								&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;        &lt;span class="gc_class_kd"&gt;var&lt;/span&gt; &lt;span class="gc_class_nv"&gt;image&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_bp"&gt;UIImage&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;:&lt;/span&gt; &lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;
        &lt;span class="gc_class_k"&gt;if&lt;/span&gt; &lt;span class="gc_class_n"&gt;image&lt;/span&gt; &lt;span class="gc_class_p"&gt;==&lt;/span&gt; &lt;span class="gc_class_kc"&gt;nil&lt;/span&gt; &lt;span class="gc_class_p"&gt;{&lt;/span&gt;
            &lt;span class="gc_class_n"&gt;image&lt;/span&gt; &lt;span class="gc_class_p"&gt;=&lt;/span&gt; &lt;span class="gc_class_bp"&gt;UIImage&lt;/span&gt;&lt;span class="gc_class_p"&gt;.&lt;/span&gt;&lt;span class="gc_class_n"&gt;imageFromWebPData&lt;/span&gt;&lt;span class="gc_class_p"&gt;(&lt;/span&gt;&lt;span class="gc_class_n"&gt;data&lt;/span&gt;&lt;span class="gc_class_p"&gt;)&lt;/span&gt;
        &lt;span class="gc_class_p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
							&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;&lt;p&gt;&lt;span style="font-family: Georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;a href="https://github.com/smiceli/DisplayWebP"&gt;Demo code on GitHub&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Sample code is provided on &lt;a href="https://github.com/smiceli/DisplayWebP"&gt;my GitHub&lt;/a&gt;. Check it out. 😄 The code also shows how to simply download images in the background and display them in a UICollectionView.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 18px; font-family: Georgia;"&gt;&lt;strong&gt;Documentation&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="https://developers.google.com/speed/webp/docs/api"&gt;Google's WebP Documentation&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Good luck with your app.&lt;/p&gt;
					
				&lt;/div&gt;
			</description>
			<pubDate>Sat, 27 Feb 2016 12:03:41 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/how-to-display-webp-images.html</guid>
            
			
		</item>
		<item>
			<title>Always set NSError pointers to nil, Duh!</title>
			<link>http://www.grokkingcocoa.com/always-set-nserror-pointers.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;This is one of those errors that just make you go, duh!&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Can you spot the problem with the following two snippets of code?&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Snippet 1&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #7e11ad;"&gt;NSError&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; *error;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;if&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; (![someObject &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;performFetch&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;:&amp;amp;error])&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;        &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;NSLog&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;(&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #e90000;"&gt;@&amp;quot;%@: %@&amp;quot;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;, [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;description&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;], [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;userInfo&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;]);&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Snippet 2&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #7e11ad;"&gt;NSError&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; *error;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;if&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; (![&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;.&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #368288;"&gt;someObject&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;performFetch&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;:&amp;amp;error])&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;        &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;NSLog&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;(&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #e90000;"&gt;@&amp;quot;%@: %@&amp;quot;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;, [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;description&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;], [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;userInfo&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;]);&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;At first this does not appear to be a problem, but what if someObject is nil in the first case or the accessor self.someObject returns nil in the second?  If either is nil then the message is sent to the nil object which will cause the conditional to fire (a message sent to the nil object returns 0 or nil). Now when error is used it has an uninitialized value, which will probably cause things to blow up, but now always.&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;The solution to initialize error to nil,&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #7e11ad;"&gt;NSError&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; *error = &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;nil&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;if&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; (![&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;.&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #368288;"&gt;someObject&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;performFetch&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;:&amp;amp;error])&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;        &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;NSLog&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;(&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #e90000;"&gt;@&amp;quot;%@: %@&amp;quot;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;, [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;description&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;], [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;userInfo&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;]);&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana; min-height: 15.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Or in some cases add a check for the NSError also,&lt;/span&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #7e11ad;"&gt;NSError&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; *error = &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;nil&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;;&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;    &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;if&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; (![&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;.&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #368288;"&gt;someObject&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;performFetch&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;:&amp;amp;error])&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;        &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #d200a5;"&gt;if&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt; (error)&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;"&gt;&lt;tt&gt;&lt;span style="letter-spacing: 0.0px;"&gt;            &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;NSLog&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;(&lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #e90000;"&gt;@&amp;quot;%@: %@&amp;quot;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;, [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;description&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;], [error &lt;/span&gt;&lt;span style="letter-spacing: 0.0px color: #480085;"&gt;userInfo&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;]);&lt;/span&gt;&lt;/tt&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana; min-height: 15.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Always do one of these as the above mistake is simple to make.&lt;/span&gt;&lt;/p&gt;
					&lt;div&gt;&lt;br /&gt;
					&lt;/div&gt;
					&lt;/p&gt;
					
					&lt;/div&gt;
			</description>
			<pubDate>Fri, 04 Jun 2010 05:09:40 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/always-set-nserror-pointers.html</guid>
            
			<category>NSError Code Programming Cocoa</category>
		</item>
		<item>
			<title>No Love in the App Store</title>
			<link>http://www.grokkingcocoa.com/no-love-in-the-app-store.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;One of the problems, the main problem. of Apple's App Store is hierarchy.&lt;/p&gt;
					
					
					
					&lt;p&gt;What? What does structure have to do with it. I am not talking about structure as in a folder hierarchy, but more to do with the pecking order. I have to explore this idea a little before I can tie it to the App Store.&lt;/p&gt;
					
					
					
					&lt;p&gt;I am an Indie developer. I don't do this for no other reason but that I love crafting software. I am in someways like that stereotypical computer geek. I dislike hierarchy. The hierarchy in the pecking order. I want to do things for the heck of it, because I love to do them, to explore, to learn. In some ways this is antiauthoritarian. It is the way of the creative.&lt;/p&gt;
					
					
					
					&lt;p&gt;Becoming part of the pecking order starts to define who you are. It becomes a status thing. It defines your position in the company. You start making decisions with regard to the hierarchy. You might not even realize this, but how many decisions are made because of your place in the company, of your place in the hierarchy. Think about it.&lt;/p&gt;
					
					
					
					&lt;p&gt;Now what does this do to your creativity in creating great software. How constrained are we to create software the way it should be? It is easier to create great software when the hierarchy is small than when it is large. The hierarchy limits creativity. It is in fact even antagonistic to it.&lt;/p&gt;
					
					
					
					&lt;p&gt;This is why some developers start going indie. They want to have the control, the freedom, to create software the way it should be created. To make the decisions for good or for bad. Not to be limited by hierarchy. In hierarchy, the love of crafting software is stifled. Crushed.&lt;/p&gt;
					
					
					
					&lt;p&gt;Hierarchy does have its place though. I am not going to mention the positives of it. I am more interested here in what it does to the creative process.&lt;/p&gt;
					
					
					
					&lt;p&gt;Now what does this have to do with the App Store? It is simple. The App store has a hierarchy and people make decisions based of this hierarchy.&lt;/p&gt;
					
					
					&lt;p&gt;People have been condescending to the hierarchy of the App Store. What app can I make that will get me in the top 100, the top 10. Yes, money can be made this way. Lots of it. But look at all the crap apps we have.
					&lt;/p&gt;
					
					&lt;p&gt;I hate it. I started making decisions based on it. I created some apps with the app market place in mind. I fell into the trap of the hierarchy. I condescended to the market place. The apps were, kind a, well OK. But I didn't like them. One remains half finished. The other is unreleased.&lt;/p&gt;
					
					&lt;p&gt;This is why I dislike the App Store. I don't want the decisions to come from the hierarchy, I want them to come from the freedom I have to make them myself. I get this sense from the Mac market, as each app is treated mostly on its merits as it is sold individually by each company (yes, there is a hierarchy here tool, but it is small). I don't get this sense from the App Store market.&lt;/p&gt;
					
					&lt;p&gt;I love developing for the Mac. The iPhone OS not as much, until I realized this. Now my focus has changed and I am loving the iPhone OS development also.&lt;/p&gt;
					
					&lt;p&gt;All this has to be kept in the context of a professional Indie developer. This is a lopsided view of the hierarchy and how it affects crafting software.&lt;/p&gt;
					
					
					
					&lt;/div&gt;
			</description>
			<pubDate>Sun, 30 May 2010 06:51:23 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/no-love-in-the-app-store.html</guid>
            
			<category>App Store</category><category>Indie Development</category><category>iPhone</category><category>iPad</category>
		</item>
		<item>
			<title>A Simple Way to Animate a UIBarButtonItem</title>
			<link>http://www.grokkingcocoa.com/a-simple-way-to-animate-a-u.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="6"&gt;&lt;span style="font-size: 24px;"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="6"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;p&gt;&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;span style="font-size: 10px;"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;span style="font-size: medium;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;font color="#480085" face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;span style="font-size: 10px;"&gt;&lt;font color="#000000" face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					&lt;font color="#480085" face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;font color="#000000" face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;font color="#480085" face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;span style="font-size: 10px;"&gt;&lt;font color="#000000" face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					&lt;font color="#480085" face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;font color="#000000" face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;My first pass solution to animate a UIBarButtonItem was to initialize it's custom view with a UIImageView. The UIImageView can then be set up for animation with multiple images. Calling startAnimaiton/stopAnimation on the UIImaveView will then animate. This is great for animating buttons in tool and tab bars.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;b&gt;One problem&lt;/b&gt; is that the when initializing the UIImageView into the UIBarButtonItem, the UIBarButtonItem does not respond to touch events. Yuk.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;A simple solution is to initialize the UIBarButtonItem custom view with a UIButton, then touch events for the UIBarButtonItem item are handle correctly.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;But the UIButton does not have a way to use a UIImageView only UIImages. We want to use the UIImageView for its simple animation.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;b&gt;The solution&lt;/b&gt; is to add the UIImageView as a subview of the UIButton.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 16.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;Here is the code.&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 12.0px Anonymous; color: #480085;"&gt;&lt;span style="color: #7e11ad;"&gt;&lt;font face="'Courier New'"&gt;NSArray&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt; *images = [&lt;/font&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;&lt;font face="'Courier New'"&gt;NSArray&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt; &lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;arrayWithObjects&lt;/font&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Anonymous; color: #e90000;"&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;        [&lt;/font&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;&lt;font face="'Courier New'"&gt;UIImage&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style="color: #480085;"&gt;&lt;font face="'Courier New'"&gt;imageNamed&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;@&amp;quot;image0.png&amp;quot;&lt;/font&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;],&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Anonymous; color: #e90000;"&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;        [&lt;/font&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;&lt;font face="'Courier New'"&gt;UIImage&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style="color: #480085;"&gt;&lt;font face="'Courier New'"&gt;imageNamed&lt;/font&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;@&amp;quot;image1.png&amp;quot;&lt;/font&gt;&lt;span style="color: black;"&gt;&lt;font face="'Courier New'"&gt;],&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Anonymous;"&gt;&lt;font face="'Courier New'"&gt;        &lt;/font&gt;&lt;span style="color: #d200a5;"&gt;&lt;font face="'Courier New'"&gt;nil&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #490085;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;imageView = [[UIImageView &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;alloc&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;] &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;initWithImage&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:[UIImage  &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;imageNamed&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:@&amp;quot;image0.png&amp;quot;]];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="'Courier New'"&gt;&lt;br /&gt;
					
					&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #7e11ad;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;imageView.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;animationImages&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt; = images;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #7e11ad; min-height: 12.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					
					&lt;/font&gt;
					&lt;/span&gt;&lt;/font&gt;&lt;font face="'Courier New'"&gt;
					
					&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #490085;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;UIButton *button = [UIButton &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;buttonWithType&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;UIButtonTypeCustom&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #368288;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;font face="'Courier New'"&gt;button&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;.&lt;/font&gt;&lt;span style="color: rgb(126, 17, 173);"&gt;&lt;font face="'Courier New'"&gt;bounds&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt; = &lt;/font&gt;&lt;span style="color: rgb(210, 0, 165);"&gt;&lt;font face="'Courier New'"&gt;self&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;.i&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;mageView&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;.&lt;/font&gt;&lt;span style="color: rgb(126, 17, 173);"&gt;&lt;font face="'Courier New'"&gt;bounds&lt;/font&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #368288;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;[button &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;addSubview&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;self&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;.i&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;mageView&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="'Courier New'"&gt;&lt;br /&gt;
					
					&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #490085;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;[button &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;addTarget&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:self &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;action&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:@selector(buttonTouched:) &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;forControlEvents&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;UIControlEventTouchUpInside&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 29.7px; text-indent: -2.5px; font: 10.0px Anonymous; color: #490085;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;UIBarButtonItem *barButton = [[[UIBarButtonItem &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;alloc&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;] &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;initWithCustomView&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;: button] &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;autorelease&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;br /&gt;
					
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;br /&gt;
					
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;font face="Verdana" size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;b&gt;Some things to notice:&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;br /&gt;
					
					&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 30.5px; text-indent: -2.0px; font: 10.0px Anonymous;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font face="Anonymous" size="3"&gt;&lt;span style="font-size: 12px;"&gt;The UIButton is of zero area as it does not have its bounds set upon initialization, thus the bounds are initialized with the bounds of the UIImageView (which has its bounds initialized from the image).&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 30.5px; text-indent: -2.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;font face="Anonymous" size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					
					
					
					&lt;/span&gt;&lt;/font&gt;
					&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 30.5px; text-indent: -2.0px; font: 10.0px Anonymous;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font face="Anonymous" size="3"&gt;&lt;span style="font-size: 12px;"&gt;The UIButton handles the action/target for the touch event. The UIBarButtonItem's action/target are not set.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;/span&gt;&lt;br /&gt;
					
					
					
					
					&lt;/p&gt;
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; min-height: 12.0px;"&gt;&lt;br /&gt;
					
					&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font face="Anonymous" size="3"&gt;&lt;span style="font-size: 12px;"&gt;To animate:&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; color: #480085;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;    [imageView &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;startAnimating&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12px;"&gt;&lt;font face="'Courier New'"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Anonymous; color: #480085;"&gt;&lt;br /&gt;
					
					
					
					&lt;/p&gt;
					
					
					
					&lt;div&gt;&lt;font face="Verdana" size="3"&gt;&lt;span style="font-size: 12px;"&gt;Have fun,&lt;br /&gt;
					
					&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
					
					&lt;div&gt;&lt;font color="#480085"&gt;&lt;font color="#000000"&gt;&lt;font face="Verdana" size="3"&gt;&lt;span style="font-size: 12px;"&gt;Sean&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#480085" face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;font color="#000000" face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;
					
					&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="2"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif"&gt;
					
					&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="6"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;
					
					&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					&lt;p&gt;&lt;font face="Anonymous, Helvetica, Arial, sans-serif" size="6"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif" size="3"&gt;
					
					
					
					
					&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					&lt;p&gt;
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					&lt;p&gt;
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					&lt;/div&gt;
			</description>
			<pubDate>Sat, 29 May 2010 23:24:01 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/a-simple-way-to-animate-a-u.html</guid>
            
			<category>iPhone</category><category>code snippets</category><category>technical</category>
		</item>
		<item>
			<title>How to Debug iPhone Unit Tests</title>
			<link>http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;font face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;[Updated the troubleshooting section 10/4/2009]&lt;/p&gt;
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;The unit tests are finally set up for the iPhone. You can start doing some Test Driven Development, but one is failing. I've read Apple's documentation, but how do I debug the blasted thing?&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;NSLog messages can be scattered throughout the code. Their output is sent to the console, but this is a pain. There must be a better way.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;This is one area that needs to be improved in Xcode. There is not even documentation on how to debug unit tests.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Here's how to do it.&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;The following assumes that you have set up the unit tests using the templates in Xcode and follows along with Apple's example in their &lt;a href="http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html#//apple_ref/doc/uid/TP40007959-CH20-SW3"&gt;&lt;span&gt;iPhone Development Guide&lt;/span&gt;&lt;/a&gt;. If you have not already set up your units test then the &lt;a href="http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html#//apple_ref/doc/uid/TP40007959-CH20-SW3"&gt;&lt;span&gt;iPhone Development Guide&lt;/span&gt;&lt;/a&gt; is a good place to start. I am also using Xcode 3.2.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Three steps that need to be performed.&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;    1. Setup a target that contains the unit tests, but does not run them.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;    2. Setup the otest executable to run the tests.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;    3. Setup the otest environment so that otest can find your unit tests.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Setting up the Target&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;When the target is set to run unit tests, Xcode runs a script that runs the unit tests. We need a similar target, but one that does not run the script.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;The easiest thing to do is duplicate the existing target (in Apple's examples &lt;i&gt;LogicTests&lt;/i&gt;). Right click (or control left click) on the LogicTests target and select Duplicate from the context menu. This will create a new target with a name like &lt;i&gt;LogicTest copy&lt;/i&gt;. Now in the &lt;i&gt;LogicTests copy&lt;/i&gt; target, delete the &lt;i&gt;Run Script&lt;/i&gt; build phase (select the &lt;i&gt;Run Script&lt;/i&gt; item and press the delete key).&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;The target can also be setup as if creating a new unit test target. Just set it up and delete the &lt;i&gt;Run Scripts&lt;/i&gt; build phase. I find it easier to copy the existing Unit Tests. This makes it easier to duplicate any changed build settings and files/frameworks that were added. If I am feeling good I then change the &lt;i&gt;LogicTests copy&lt;/i&gt; to &lt;i&gt;LogicTest Debug&lt;/i&gt; wherever I find it.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Important&lt;/b&gt;: This step will create a duplicate Product that will have to be renamed. For example, after the above duplication, there will be a two &lt;i&gt;LogicTests.octest&lt;/i&gt;. Rename the second one to &lt;i&gt;LogicTests coy.octest&lt;/i&gt; in the Product group in the project window.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Now to setup otest.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Setting up otest&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Xcode places the unit tests in a bundle then uses otest to run them. What needs to be done is to create a Custom Executable that will run otest with our &lt;i&gt;LogicTests copy&lt;/i&gt; bundle. The tricky part is finding the correct otest.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;If you go to /Developer/Tools, you will find that there is an otest there. This is the &lt;b&gt;wrong&lt;/b&gt; otest. This is one is for the Mac. We need one for the iPhone simulator. &lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Execute the following command in a Terminal window to find the correct otest.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;    find /Developer -name otest&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;This will hopefully give you a list of otest found. For example, in my development environment the correct otest is:&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/Developer/usr/bin/otest&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;What a mess. Not as nice as /Developer/Tools/otest&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Now a custom executable needs to be set up.  In your projects project window select &lt;i&gt;Executables&lt;/i&gt; and bring up the context menu. Select &lt;i&gt;add &lt;/i&gt;then &lt;i&gt;New Custom Executable...&lt;/i&gt; I put otest as the executable name, but most importantly place the path to the above found otest. Again in my environment:&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/Developer/usr/bin/otest&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Press &lt;i&gt;Finish&lt;/i&gt; and a panel will pop up. We need to configure this panel so that otest will use our unit test bundle.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Setting up the otest Environment&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;The environment needs to be set up so that otest can find our unit test. In the otest info panel, select the &lt;i&gt;arguments&lt;/i&gt; tab. We need to place the name of our unit test bundle as an argument to otest. In our example, &amp;quot;&lt;i&gt;LogicTests copy.octest&amp;quot;&lt;/i&gt; (quotes are needed if there are spaces in the name).  Go ahead and click the little plus sign and add this to the arguments list.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;You can do &lt;i&gt;man otest&lt;/i&gt; in a Terminal window to find out more on otest.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Now we need to set up a mess of environment variables. I have not checked if this is the minimum set, but it works. Add the following to the environment variables list.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;table cellspacing="0" cellpadding="0" style="border-collapse: collapse;"&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tbody&gt;
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;DYLD_LIBRARY_PATH&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;${BUILD_PRODUCTS_DIR}:${DYLD_LIBRARY_PATH}&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;DYLD_FRAMEWORK_PATH&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;&amp;quot;${BUILD_PRODUCTS_DIR}:${DEVELOPER_LIBRARY_DIR}/Frameworks:${DYLD_FRAMEWORK_PATH}&amp;quot;&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;DYLD_NEW_LOCAL_SHARED_REGIONS&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;YES&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;CFFIXED_USER_HOME&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;&amp;quot;${HOME}/Library/Application Support/iPhone Simulator/User&amp;quot;&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;IPHONE_SIMULATOR_ROOT&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;$SDKROOT&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;DYLD_NO_FIX_PREBINDING&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;YES&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 238.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt;DYLD_ROOT_PATH&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;td valign="middle" style="width: 631.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cacccb #cacccb #cacccb #cacccb; padding: 0.0px 5.0px 0.0px 5.0px;"&gt;
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;i&gt; /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk&lt;/i&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/td&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tr&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/tbody&gt;
					&lt;/table&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Double check these values and make sure they are correct for your environment.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Running/Debugging the Unit Test&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Now you can run the unit test. Select the &lt;i&gt;LogicTests copy&lt;/i&gt; as the active target. Select the otest executable as the active executable. Now you should be able to run, debug, and set breakpoints like any other normal executable.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Don't forget if you add any files to the unit tests, add them to both targets, i.e. &lt;i&gt;LogicTests&lt;/i&gt; and &lt;i&gt;LogicTests copy&lt;/i&gt;.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;Happy unit testing and TDD.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;Troubleshooting&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;If you get errors like, &lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;SenTestingKit/SenTestingKit.h: No such file or directory&lt;span style="font: 12.0px 'Lucida Grande';"&gt;&lt;br /&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/span&gt;cannot find interface declaration for 'SenTestCase', superclass of 'LogicTests'&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;this is due to Xcode putting extra \'s before quotes in &lt;i&gt;Framework Search Path&lt;/i&gt; build setting. Remove any backslashes in this setting. Select the &lt;i&gt;LogicTest copy&lt;/i&gt; item and bring up its info panel (&lt;span style="font: 12.0px 'Lucida Grande';"&gt;⌘&lt;/span&gt;I). Select the build tab and change the &lt;i&gt;Framework Search Path&lt;/i&gt; for all configurations.&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana; min-height: 15.0px;"&gt;&lt;br /&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana;"&gt;&lt;b&gt;If you get an error like,&lt;/b&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"&gt;&lt;font color="#000000" face="Verdana"&gt;&lt;span style="background-color: transparent;"&gt;objc[16428]: '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation' was not compiled with -fobjc-gc or -fobjc-gc-only, but the application requires GC&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"&gt;&lt;font color="#000000" face="Verdana"&gt;&lt;span style="background-color: transparent;"&gt;objc[16428]: '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' was not compiled with -fobjc-gc or -fobjc-gc-only, but the application requires GC&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"&gt;&lt;font color="#000000" face="Verdana"&gt;&lt;span style="background-color: transparent;"&gt;objc[16428]: *** GC capability of application and some libraries did not match&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"&gt;&lt;font color="#000000" face="Verdana"&gt;&lt;span style="background-color: transparent;"&gt;&lt;br /&gt;
					
					
					
					&lt;/span&gt;&lt;/font&gt;
					
					
					
					
					
					
					
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"&gt;&lt;font color="#000000" face="Verdana"&gt;&lt;span style="background-color: transparent;"&gt;the wrong otest was selected. Make sure the path to the correct iPone simulator is selected in the General tab of the otest info panel.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;div&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;br /&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;font&gt;&lt;span style="background-color: transparent;"&gt;&lt;b&gt;If you get an error like,&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;div&gt;&lt;font&gt;&lt;span style="line-height: 17px;"&gt;&lt;span style="background-color: transparent;"&gt;dyld: Symbol not found: _SCDynamicStoreCreate&lt;br /&gt;
					
					
					
					
					Referenced from: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices&lt;br /&gt;
					
					
					
					
					Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit&lt;br /&gt;
					
					
					
					
					in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices&lt;br /&gt;
					
					
					
					&lt;/span&gt;
					&lt;/span&gt;&lt;span style="background-color: transparent;"&gt;
					
					
					
					
					
					
					
					
					&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;span style="line-height: 17px;"&gt;&lt;span style="background-color: transparent;"&gt;&lt;br /&gt;
					
					
					
					&lt;/span&gt;
					&lt;/span&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;span style="line-height: 17px;"&gt;&lt;span style="background-color: transparent;"&gt;Harald reported below in the comments that setting the &lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 17px;"&gt;&lt;span style="background-color: transparent;"&gt;DYLD_FORCE_FLAT_NAMESPACE environment variable solved this (see man dyld). Add it to the list of the other environment variables set above.&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: transparent;"&gt;&lt;br /&gt;
					
					
					
					&lt;/span&gt;
					&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;span style="line-height: 17px;"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/span&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;span style="line-height: 17px;"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/span&gt;&lt;/div&gt;
					
					
					
					
					&lt;div&gt;&lt;span style="line-height: 17px;"&gt;&lt;br /&gt;
					
					
					
					
					&lt;/span&gt;&lt;/div&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;div&gt;&lt;font&gt;&lt;span style="background-color: transparent;"&gt;&lt;b&gt;If the source are not compiling&lt;/b&gt; using the new target, LogicTests copy, you probably forgot to rename the Product. See the important step above in the Setting up the Target above.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;div&gt;&lt;font face="Helvetica, Helvetica, Arial, sans-serif"&gt;&lt;br /&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/font&gt;&lt;/div&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/font&gt;&lt;/font&gt;&lt;p&gt;
					
					
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					&lt;p&gt;
					
					
					
					
					
					&lt;/p&gt;
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					&lt;/div&gt;
			</description>
			<pubDate>Thu, 08 Oct 2009 23:45:02 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html</guid>
            
			<category>iPhone</category><category>unit test</category><category>debugging</category>
		</item>
		<item>
			<title>Hello World</title>
			<link>http://www.grokkingcocoa.com/hello_world.html</link>
			<description>
				&lt;div class="article-summary"&gt;&lt;p&gt;
					What else should a geeky programmer's first post be?&lt;/p&gt;
					
					&lt;/div&gt;
			</description>
			<pubDate>Thu, 08 Oct 2009 22:49:35 -0700</pubDate>
			<guid>http://www.grokkingcocoa.com/hello_world.html</guid>
            
			
		</item>
 	</channel>
</rss>