<?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>Paul Solt &#187; Objective-C</title>
	<atom:link href="http://paulsolt.com/tag/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulsolt.com</link>
	<description>Putting the Inc back in Solt since 2005.</description>
	<lastBuildDate>Tue, 01 May 2012 15:03:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Objective-C/C++ iPhone Build Failures</title>
		<link>http://paulsolt.com/2010/11/objective-cc-iphone-build-failures/</link>
		<comments>http://paulsolt.com/2010/11/objective-cc-iphone-build-failures/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 03:38:31 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[build errors]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[GCC]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=994</guid>
		<description><![CDATA[<p>If you&#8217;re working with Objective-C/C++ (i.e. mixing both languages) in an iPhone/Mac application you may come across some strange errors in the build process due to a configuration issue.</p> error: bits/c++config.h: No such file or directory <p>One of my projects, Texture Evolution was a Mac application that referenced a C++ Mac library. About 6 months [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re working with Objective-C/C++ (i.e. mixing both languages) in an iPhone/Mac application you may come across some strange errors in the build process due to a configuration issue.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">error: bits<span style="color: #000000; font-weight: bold;">/</span>c++config.h: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory</pre></div></div>

<div id="attachment_1005" class="wp-caption aligncenter" style="width: 467px"><a href="http://paulsolt.com/wp-content/uploads/2010/11/buildFailBits.png"><img class="size-full wp-image-1005 " title="buildFailBits" src="http://paulsolt.com/wp-content/uploads/2010/11/buildFailBits.png" alt="" width="457" height="560" /></a><p class="wp-caption-text">Too many build failures</p></div>
<p>One of my projects, Texture Evolution was a Mac application that referenced a C++ Mac library. About 6 months ago I ran into an issue where my build would fail. It may have been related to an update to Xcode, but I&#8217;m not entirely sure. After a lot of time, frustration, Google&#8217;ing, and project configuration changes I came across a solution.</p>
<p>Today I ran into the same problem and couldn&#8217;t quite remember how to fix it for my Doxygen Xcode documentation Target that references the C++ Mac library. I wasted more time trying to figure it out again, so here&#8217;s the breakdown.</p>
<h3>The Problem:</h3>
<p>Using iostream.h or other STL from C++ and compiling with the Base SDK set to 10.4 and GCC 4.0.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iostream:<span style="color: #000000;">43</span>:<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iostream:<span style="color: #000000;">43</span>:<span style="color: #000000;">28</span>: error: bits<span style="color: #000000; font-weight: bold;">/</span>c++config.h: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iosfwd:<span style="color: #000000;">45</span>:<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iosfwd:<span style="color: #000000;">45</span>:<span style="color: #000000;">29</span>: error: bits<span style="color: #000000; font-weight: bold;">/</span>c++locale.h: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iosfwd:<span style="color: #000000;">46</span>:<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span>4.0.0<span style="color: #000000; font-weight: bold;">/</span>iosfwd:<span style="color: #000000;">46</span>:<span style="color: #000000;">25</span>: error: bits<span style="color: #000000; font-weight: bold;">/</span>c++io.h: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">11</span>,000+ other errors<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<h3>The Solution:</h3>
<p>Set the Base SDK to Mac OS X 10.5 and GCC to 4.2. You&#8217;ll need to make changes to project using the library as well as the libraries Target/Project settings. When you make changes make sure the Target properties displays &#8220;All Configurations&#8221; (i.e. Debug/Release/Release Adhoc/Release AppStore) so that you fix it for all of your build types. Double check and make sure that your static libraries and your project Targets have matching configurations.</p>
<p style="text-align: center;">
<div id="attachment_1000" class="wp-caption aligncenter" style="width: 471px"><a href="http://paulsolt.com/wp-content/uploads/2010/11/Screen-shot-2010-11-16-at-10.14.15-PM.png"><img class="size-full wp-image-1000 " title="Screen shot 2010-11-16 at 10.14.15 PM" src="http://paulsolt.com/wp-content/uploads/2010/11/Screen-shot-2010-11-16-at-10.14.15-PM.png" alt="" width="461" height="480" /></a><p class="wp-caption-text">Using Base SDK: Mac OS X 10.5 and GCC 4.2</p></div>
<h3>Why?</h3>
<p>It may be a simple configuration issue, but I&#8217;m not really sure. For some reason when I use GCC 4.0 it builds against arm and uses the iPhone SDK, but when I use GCC 4.2 it uses the Mac SDK. The library is explicitly targeting Mac OS X 10.4, but it doesn&#8217;t seem to work when it&#8217;s targeting GCC 4.0. Here&#8217;s the comparison build output:</p>
<h4>Base SDK Mac OS X 10.4, GCC 4.0</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">CompileC <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-CompileC <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>Objects-normal<span style="color: #000000; font-weight: bold;">/</span>armv6<span style="color: #000000; font-weight: bold;">/</span>Canvas.o ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>Canvas.cpp normal armv6 <span style="color: #c20cb9; font-weight: bold;">c++</span> com.apple.compilers.gcc.4_0
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution
setenv LANG en_US.US-ASCII
setenv PATH <span style="color: #ff0000;">&quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">4.0</span> <span style="color: #660033;">-x</span> <span style="color: #c20cb9; font-weight: bold;">c++</span> <span style="color: #660033;">-arch</span> armv6 <span style="color: #660033;">-fmessage-length</span>=<span style="color: #000000;">0</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-Wno-trigraphs</span> <span style="color: #660033;">-fpascal-strings</span> <span style="color: #660033;">-O0</span> <span style="color: #660033;">-Wreturn-type</span> <span style="color: #660033;">-Wunused-variable</span> <span style="color: #660033;">-isysroot</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS4.1.sdk <span style="color: #660033;">-mfix-and-continue</span> <span style="color: #660033;">-gdwarf-2</span> <span style="color: #660033;">-mthumb</span> <span style="color: #660033;">-miphoneos-version-min</span>=<span style="color: #000000;">3.2</span> <span style="color: #660033;">-iquote</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-generated-files.hmap -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-own-target-headers.hmap -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-all-target-headers.hmap <span style="color: #660033;">-iquote</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-project-headers.hmap -F<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>include -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>DerivedSources<span style="color: #000000; font-weight: bold;">/</span>armv6 -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>DerivedSources <span style="color: #660033;">-fvisibility</span>=hidden <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>Canvas.cpp <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug-iphoneos<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>Objects-normal<span style="color: #000000; font-weight: bold;">/</span>armv6<span style="color: #000000; font-weight: bold;">/</span>Canvas.o</pre></div></div>

<h4>Base SDK Mac OS X 10.5, GCC 4.2</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">CompileC <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>Objects-normal<span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>Canvas.o <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>Canvas.cpp normal x86_64 <span style="color: #c20cb9; font-weight: bold;">c++</span> com.apple.compilers.gcc.4_2
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution
setenv LANG en_US.US-ASCII
<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">4.2</span> <span style="color: #660033;">-x</span> <span style="color: #c20cb9; font-weight: bold;">c++</span> <span style="color: #660033;">-arch</span> x86_64 <span style="color: #660033;">-fmessage-length</span>=<span style="color: #000000;">0</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-Wno-trigraphs</span> <span style="color: #660033;">-fpascal-strings</span> <span style="color: #660033;">-fasm-blocks</span> <span style="color: #660033;">-O0</span> <span style="color: #660033;">-Wreturn-type</span> <span style="color: #660033;">-Wunused-variable</span> <span style="color: #660033;">-isysroot</span> <span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>MacOSX10.5.sdk <span style="color: #660033;">-mfix-and-continue</span> <span style="color: #660033;">-mmacosx-version-min</span>=<span style="color: #000000;">10.5</span> <span style="color: #660033;">-gdwarf-2</span> <span style="color: #660033;">-iquote</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-generated-files.hmap -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-own-target-headers.hmap -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-all-target-headers.hmap <span style="color: #660033;">-iquote</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib-project-headers.hmap -F<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>Debug -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>include -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>DerivedSources<span style="color: #000000; font-weight: bold;">/</span>x86_64 -I<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>DerivedSources <span style="color: #660033;">-fvisibility</span>=hidden <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>Xcode<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>Canvas.cpp <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>paulsolt<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>xcode_build_output<span style="color: #000000; font-weight: bold;">/</span>ArtworkEvolution.build<span style="color: #000000; font-weight: bold;">/</span>Debug<span style="color: #000000; font-weight: bold;">/</span>MacEvolutionLib.build<span style="color: #000000; font-weight: bold;">/</span>Objects-normal<span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>Canvas.o</pre></div></div>

<h3>Notes:</h3>
<p>GCC 4.2 is required for 10.5, if you try and use the Base SDK of 10.4 and GCC 4.2 you&#8217;ll get this error.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">GCC <span style="color: #000000;">4.2</span> is not compatible with the Mac OS X <span style="color: #000000;">10.4</span> SDK</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2010/11/objective-cc-iphone-build-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Unit Testing Explained &#8211; Part 1</title>
		<link>http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-1/</link>
		<comments>http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-1/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 01:05:57 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[application testing]]></category>
		<category><![CDATA[GHUnit]]></category>
		<category><![CDATA[Google Toolbox for Mac]]></category>
		<category><![CDATA[GTM iPhone Unit Testing]]></category>
		<category><![CDATA[logic testing]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[OCUnit]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testable code]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=717</guid>
		<description><![CDATA[<p>&#160;</p> <p style="text-align: justify;">Here&#8217;s the first part of a multi-part iPhone Unit Testing Series. (Updated 3/31/12 with Xcode 4 testing)</p> <p style="text-align: justify;">For the second part of<a title="iPhone Unit Testing Explained – Part II" href="http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-ii/"> iPhone Unit Testing Explain &#8211; Part II</a> </p> <p style="text-align: justify;">How comfortable are you on a bike without a helmet? [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p style="text-align: justify;"><em>Here&#8217;s the first part of a multi-part iPhone Unit Testing Series. (Updated 3/31/12 with Xcode 4 testing)</em></p>
<p style="text-align: justify;"><em>For the second part of<a title="iPhone Unit Testing Explained – Part II" href="http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-ii/"> iPhone Unit Testing Explain &#8211; Part II</a> </em></p>
<p style="text-align: justify;">How comfortable are you on a bike without a helmet? Writing code without tests is like riding a bike without a helmet. You might feel free and indestructible for now, but one day you&#8217;ll fall and it&#8217;s going to hurt.</p>
<p style="text-align: justify;">I can&#8217;t start a new project without source control, it&#8217;s one of my requirements. Personally, I feel very uncomfortable and exposed without something to track my code changes. In reality, I hardly need to revert changes, but the knowledge that I can go back to something else enables me to make bigger and more confident changes.</p>
<p style="text-align: justify;">Testing should also be a requirement and it doesn&#8217;t get enough attention in the classroom or on code projects. Part of the problem is that there is a lack of information and the high learning curve. Most tutorials provide the bare minimum and don&#8217;t provide real world examples. There are two major hurdles that you&#8217;ll need to overcome.</p>
<h3 style="text-align: justify;">1. How do I use this testing framework?</h3>
<p style="text-align: justify;">Getting started with some new technology is always a daunting task. The only way you&#8217;re going to learn is if you teach yourself. Make sure to free yourself from distractions and get a cup of coffee so you can think clearly. When there are lots of unit testing frameworks and you need to evaluate what your requirements are going to be. For beginners it&#8217;s not always clear and you&#8217;re going to have to sample the available options.</p>
<ul style="text-align: justify;">
<li>C++: <a href="http://www.boost.org/doc/libs/1_35_0/libs/test/doc/components/utf/index.html">Boost Test Library</a>, <a href="http://code.google.com/p/googletest/">Google Test</a>, <a href="http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page">CppUnit</a> (<a href="http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle">C++ Unit Testing Roundup</a>)</li>
<li>Objective-C: <a href="http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html">OCUnit</a>, <a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting">GTM iPhone Unit Testing</a>, <a href="https://github.com/gabriel/gh-unit">GHUnit</a></li>
</ul>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-2182421302031373";
/* 468x15, created 11/9/10 */
google_ad_slot = "7180498408";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h3 style="text-align: justify;">2. How do I write testable code?</h3>
<p style="text-align: justify;">Most computer science courses don&#8217;t explain how to write testable code, they focus on the output matching. Students assume that if my code displays X and I&#8217;m trying to display X, then the code must be correct. Testable code can be hard to master, but it&#8217;s worth the effort. There&#8217;s two important aspects of unit testing that I&#8217;ve discovered.</p>
<p style="padding-left: 30px; text-align: justify;">a. A unit test, or a set of unit tests, validates that the function you just wrote works like you think it works. It takes microseconds for the computer to tell you if something works or not, and it takes you seconds or minutes to validate if it works. Your time is valuable, let computers do the grunt work of testing and you&#8217;ll have more time to write code.</p>
<p style="padding-left: 30px; text-align: justify;">b. Unit tests force design testing. High-level designs don&#8217;t translate into direct code without usability issues. As you write and test code you will find that a function should take X parameters instead of Y parameters, or that the function name doesn&#8217;t match the functionality it provides. Take the time to fix your design and you&#8217;ll have code that&#8217;s easier to use and better documented. The sooner you fix design issues, the more time you&#8217;ll have to work on features.</p>
<p style="text-align: justify;">I still haven&#8217;t answered how to write <a href="http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html#//apple_ref/doc/uid/TP40007959-CH20-SW12">testable code</a>. Getting started is a matter of baby steps; take two steps at a time, and soon you&#8217;ll be walking.</p>
<p style="padding-left: 30px; text-align: justify;">a. Isolate the basic functions that have clear input and output. Write a test that provides a function with good input and bad input. Think about what additional functions you&#8217;ll need to prove that the function you&#8217;re testing works as expected. For example, in order to test a setter function, you&#8217;ll need a getter function. As you write more tests, refactor common tasks into helper functions, so that you can spend more time testing functionality instead of writing boilerplate test code.</p>
<p style="padding-left: 30px; text-align: justify;">b. Make sure you <strong>document</strong> each function as you test it, if you don&#8217;t write comments now, it&#8217;s never going to happen. Documentation is best when the details of the function are fresh in your mind and you can explain the edge cases.</p>
<p style="text-align: justify;">Not everything is easy to test, but don&#8217;t be discouraged, since the tests you write will begin to validate that your code works as documented. You&#8217;re making progress and it&#8217;s going to get easier as you write more tests. Another benefit is that you&#8217;ll have higher quality code that you can rely on into the future.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-2182421302031373";
/* Large Post Ad */
google_ad_slot = "4358587115";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h2 style="text-align: justify;"><strong>iPhone Testing</strong></h2>
<p style="text-align: justify;">Over the past weekend I set out to integrate a unit test framework into my current project. I ended up testing three different frameworks: OCUnit, Google Toolbox for Mac (GTM) iPhone Unit Testing, and GHUnit. I will provide a brief overview and pros and cons to each framework and my final conclusion.</p>
<h3 style="text-align: justify;"><a href="http://www.sente.ch/software/ocunit/">OCUnit</a> (SenTesting)</h3>
<h5 style="text-align: justify;"><strong>Pros</strong>:  Xcode integration (super easy), acceptance testing during builds, test debugging in Xcode 4 (<strong>Updated 3/31/12 for Xcode 4 improvements)</strong></h5>
<ul style="text-align: justify;">
<li>Xcode 4+ has built in support for unit testing using the <a href="http://www.sente.ch/software/ocunit/">OCUnit</a> testing (SenTesting) framework. It&#8217;s easy to create a new test case, since there are Xcode test/target templates.</li>
<li style="text-align: justify;">Xcode can display test failures like syntax errors with the <em>code bubbles</em> during the build/run stages, which can facilitate acceptance testing. These errors will link to the file and unit test that is failing, which is very helpful in terms of usability.</li>
</ul>
<div class="mceTemp mceIEcenter" style="text-align: justify;">
<dl id="attachment_854" class="wp-caption aligncenter" style="width: 565px;">
<dt class="wp-caption-dt"><a href="http://paulsolt.com/wp-content/uploads/2010/11/OCTest-Code-Bubble.png"><img class="size-full wp-image-854 " title="OCTest Code Bubble" src="http://paulsolt.com/wp-content/uploads/2010/11/OCTest-Code-Bubble.png" alt="" width="555" height="507" /></a></dt>
<dd class="wp-caption-dd">OCTest Unit Test Failure Code Bubble</dd>
</dl>
</div>
<h5 style="text-align: justify;"><strong>Cons</strong>:  logic tests vs. application tests, device/simulator test limitations</h5>
<ul style="text-align: justify;">
<li><del>There are far too many steps required to create the unit tests in Xcode 3.2.4. I&#8217;m not sure why more of the process isn&#8217;t automated, maybe in Xcode 4? To provide test coverage I needed to create 3 additional test targets each with specific <a href="http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html">settings</a>. </del></li>
<li><del>Writing a test for something basic (addition) is trivial using OCUnit, but testing code (memory management) that may crash isn&#8217;t. You need to follow a special set of instructions to get unit testing debugging work, otherwise you&#8217;ll be scratching your head. (<a href="http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html">Link 1</a>) (<a href="http://chanson.livejournal.com/120740.html?thread=455332">Link 2</a>) (<a href="http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html#disqus_thread">Link 3</a>)</del></li>
<li>Apple created their own categories of tests:<em> logic tests</em> and <em>application tests</em>, but the distinction isn&#8217;t clear. <em>Logic tests</em> are meant to test code that doesn&#8217;t use any UI code, while <em>Application tests</em>are designed for testing UI related code. This sounds fine, but when you try to create unit tests, the code you&#8217;re testing becomes very tightly coupled to the tests you can write.
<ul>
<li style="text-align: justify;">For example, <em>logic tests</em> are not run in an application, so code that would provide a <em>documents</em> or <em>bundle</em> directory for saving/loading may not work without refactoring the code.</li>
</ul>
</li>
</ul>
<ul style="text-align: justify;">
<li>The biggest limitation is that <em>logic tests</em> only run using the iPhone Simulator and <em>application tests</em> only run on the device. <em>Logic tests </em>are not run when you build for the actual device, so you have to constantly switch between simulator/device to get acceptance test coverage. Running <em>application tests</em> only on the device is very slow, compared to running it in the iPhone Simulator.</li>
</ul>
<div class="mceTemp mceIEcenter" style="text-align: justify;">
<dl id="attachment_856" class="wp-caption aligncenter" style="width: 538px;">
<dt class="wp-caption-dt"><a href="http://paulsolt.com/wp-content/uploads/2010/11/OCTest-Log-output.png"><img class="size-full wp-image-856 " title="OCTest Log output" src="http://paulsolt.com/wp-content/uploads/2010/11/OCTest-Log-output.png" alt="" width="528" height="517" /></a></dt>
<dd class="wp-caption-dd">OCTest Application Testing on the Device</dd>
</dl>
</div>
<h3 style="text-align: justify;"><a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting">Google Toolbox for Mac (GTM):  iPhone Unit Testing</a></h3>
<h5 style="text-align: justify;"><strong>Pros</strong>:  Xcode integration, acceptance testing during builds, easy setup</h5>
<ul style="text-align: justify;">
<li>GTM iPhone unit testing provides <em>code bubbles</em> with test failures, like OCUnit, when building the target for the iPhone Simulator. The failure indicators are better than OCUnit, since it includes the error icon on the line of failure in GTM. However, the <em>code bubbles</em> do not appear when building for the device. The code bubbles can be clicked on to take you to the unit test that is failing. You can perform acceptance testing when building for the iPhone Simulator.</li>
</ul>
<div class="mceTemp mceIEcenter" style="text-align: justify;">
<dl id="attachment_850" class="wp-caption aligncenter" style="width: 550px;">
<dt class="wp-caption-dt"><a href="http://paulsolt.com/wp-content/uploads/2010/11/GTM-Code-bubble.png"><img class="size-full wp-image-850 " title="GTM Code bubble" src="http://paulsolt.com/wp-content/uploads/2010/11/GTM-Code-bubble.png" alt="" width="540" height="539" /></a></dt>
<dd class="wp-caption-dd">GTM iPhone Unit Testing Test Failure Code Bubbles</dd>
</dl>
</div>
<ul style="text-align: justify;">
<li>Compared to OCTest, GTM iPhone Unit Testing is a breeze to setup. You can write unit tests that target the UI and logic of your code within the same class.</li>
</ul>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-2182421302031373";
/* 468x15, created 11/9/10 */
google_ad_slot = "7180498408";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h5 style="text-align: justify;"><strong>Cons</strong>:  Documentation, output</h5>
<ul style="text-align: justify;">
<li>GTM iPhone unit testing was straightforward to setup using the <a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting">google code guide</a>. The documentation is a little sparse, but it provides enough to get going. I think pictures would help explain the process and help break up all the text. I found the following visual <a href="http://www.kaomte.com/blog/?p=46">tutorial</a> semi-helpful, but there&#8217;s no definitive source.</li>
<li>When building a test and running the script during the build phase there is a lot of extraneous output that can be overwhelming. Some of the output is visible in the previous code bubble screenshot and the screenshot below. The output is not formatted as nicely as the OCTest output.</li>
</ul>
<div class="mceTemp mceIEcenter" style="text-align: justify;">
<dl id="attachment_852" class="wp-caption aligncenter" style="width: 552px;">
<dt class="wp-caption-dt"><a href="http://paulsolt.com/wp-content/uploads/2010/11/GTM-Log-Output.png"><img class="size-full wp-image-852 " title="GTM Log Output" src="http://paulsolt.com/wp-content/uploads/2010/11/GTM-Log-Output.png" alt="" width="542" height="449" /></a></dt>
<dd class="wp-caption-dd">GTM iPhone Unit Testing Log Output from a Test Run</dd>
</dl>
</div>
<h3 style="text-align: justify;"><a href="https://github.com/gabriel/gh-unit">GHUnit</a></h3>
<h5 style="text-align: justify;"><strong>Pros</strong>:  Device/simulator testing, easy debugging, easy setup, iPhone Test Result GUI, command line interface</h5>
<ul style="text-align: justify;">
<li>GHUnit has the easiest setup process of the three unit testing frameworks. It&#8217;s based on GTM and it is capable of running OCUnit, GTM, and GHUnit test cases. The <a href="http://gabriel.github.com/gh-unit/">documentation</a> is pretty good and there is a nice <a href="http://4arrowsmedia.com/2010/09/ghunit-setup/">visual setup guide</a>.</li>
</ul>
<ul style="text-align: justify;">
<li>GHUnit is easy to debug any test case without any additional setup. Place a breakpoint and run the test application in the simulator or on the device.</li>
<li>GHUnit provides a way to run tests on the command line, if you want to integrate with continuous integration tools. (<a href="http://hudson-ci.org/">Hudson</a>)</li>
</ul>
<ul style="text-align: justify;">
<li>The major selling point is that it provides a graphics user interface to display the results of each test, including test duration, if performance is important. The interface allows the user to switch between all tests and failed tests in a unit test application. Additionally, it drill into a test failure to display the unit test failure message and the stack trace. After using GHUnit, GTM Unit Testing leaves a lot to be desired beyond log output for visual feedback.
<ul>
<li>The GUI enables a pleasant workflow where you can set breakpoints and re-run tests to try and isolate bugs in the test code. The workflow replaces the need to perform acceptance testing during the build process, because it is so much more interactive.</li>
<li>On iPhone 4 it will resume on the <em>All/Failed</em> tests tab that you were last running/debugging. Note:  There is a minor issue described below in the <em>cons</em> section.</li>
</ul>
</li>
</ul>
<div id="attachment_857" class="wp-caption aligncenter" style="width: 258px"><a href="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-1.png"><img class="size-full wp-image-857 " title="GHUnit Tests 1" src="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-1.png" alt="" width="248" height="462" /></a><p class="wp-caption-text">GHUnit Testing All Test Cases on the Device</p></div>
<div id="attachment_858" class="wp-caption aligncenter" style="width: 258px"><a href="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-2.png"><img class="size-full wp-image-858 " title="GHUnit Tests 2" src="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-2.png" alt="" width="248" height="462" /></a><p class="wp-caption-text">GHUnit Test Case Failures</p></div>
<div id="attachment_859" class="wp-caption aligncenter" style="width: 258px"><a href="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-3.png"><img class="size-full wp-image-859 " title="GHUnit Tests 3" src="http://paulsolt.com/wp-content/uploads/2010/11/GHUnit-Tests-3.png" alt="" width="248" height="462" /></a><p class="wp-caption-text">GHUnit Test Case Failure Message</p></div>
<h5 style="text-align: justify;"><strong>Cons</strong>:  No acceptance testing, Documentation, minor GUI issues, Setup Time</h5>
<ul style="text-align: justify;">
<li>There is no way to run tests as part of the build process using GHUnit. It&#8217;s a paradigm shift from the OCUnit and other similar unit testing frameworks that enable testing during the build process. However, you can use a <a href="http://www.martinfowler.com/articles/continuousIntegration.html">continuous integration</a> framework to run unit testing as you check in code to a central repository.</li>
</ul>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-2182421302031373";
/* 468x15, created 11/9/10 */
google_ad_slot = "7180498408";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<ul style="text-align: justify;">
<li>Documentation is good, but it could be better. The behaviors of the GUI are not clearly defined. Finding the GHUnitIOS.Framework was not clear in the documentation. I updated an article on <a href="https://github.com/gabriel/gh-unit/wiki/Where-is-GHUnitIOS.Framework">github</a> that addressed the documentation issue.</li>
<li>There are some minor GUI issues, if you use the GUNIT_AUTORUN environment variable. If you switch to the <em>Failed</em> tests tab on the GUI, it will only run the failed tests. Running the subset is good when you&#8217;re fixing an issue, but it can be confusing if you&#8217;re adding a new test. The new test won&#8217;t run until you switch back to the <em>All</em>tests tab. Setting a breakpoint on the new test, will also do nothing, since it doesn&#8217;t run.
<ul>
<li>I&#8217;d like to see an additional button on the <em>Failed</em> tests tab that says &#8220;Run All Tests&#8221; and on the <em>All </em>tests tab a &#8220;Run Failed Tests&#8221; button. I think the additional buttons would make it clear that run doesn&#8217;t always do the same thing.</li>
</ul>
</li>
</ul>
<div class="mceTemp mceIEcenter" style="text-align: justify;">
<dl id="attachment_861" class="wp-caption aligncenter" style="width: 258px;">
<dt class="wp-caption-dt"><a href="http://paulsolt.com/wp-content/uploads/2010/11/One-previous-failure-fixed.png"><img class="size-full wp-image-861 " title="One previous failure fixed" src="http://paulsolt.com/wp-content/uploads/2010/11/One-previous-failure-fixed.png" alt="" width="248" height="462" /></a></dt>
<dd class="wp-caption-dd">Only the Test Failures are Rerun on the Failed Tests Tab</dd>
</dl>
</div>
<h3 style="text-align: justify;">Conclusion</h3>
<p style="text-align: justify;"><strong>Update: 3/31/12</strong> With Xcode 4, creating and debugging unit tests in Xcode is so easy, it&#8217;s not worth the initial effort to integrate GHUnit, unless you need visual feedback on the device.</p>
<p style="text-align: justify;">I would recommend using the built in Xcode 4 unit testing bundles and then add GHUnit after the fact, when you need visual feedback. GHUnit is compatible with the default testing available in Xcode 4.</p>
<p style="text-align: justify;">The testing interface in GHUnit is the easiest to see test results and it doesn&#8217;t require as much log output digging. I like the workflow I have when using GHUnit.</p>
<ol>
<li>Switch to the GHUnit Test Target</li>
<li>Write unit test for new function</li>
<li>Test new function (Command-R) and see it fails (Optional)</li>
<li>Stub and implement new function</li>
<li>Test implementation (Command-R). Repeat 4 until the test passes</li>
<li>Repeat for next function</li>
<li>Switch back to the Application Test Target</li>
</ol>
<p style="text-align: justify;"><strong>Updated: (3/31/12)</strong> With the release of Xcode 4 and more integrated testing, using OCUnit/SenTest is a lot easier to get started. I will be providing a walk through on setting up Xcode 4 and working with bundle resources in the next part.</p>
<p style="text-align: justify;"><em>(<a title="iPhone Unit Testing Explained – Part II" href="http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-ii/">Part II &#8211; working with unit tests in Xcode 4</a>)</em></p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-2182421302031373";
/* Large Post Ad */
google_ad_slot = "4358587115";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-1/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>iPhone Development Talk</title>
		<link>http://paulsolt.com/2009/10/iphone-development-talk/</link>
		<comments>http://paulsolt.com/2009/10/iphone-development-talk/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 03:05:05 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CSC]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=346</guid>
		<description><![CDATA[<p>Today I gave a presentation on iPhone Development at RIT for the Computer Science Community (<a title="Computer Science Community" href="http://csc.cs.rit.edu/">CSC</a>).If you enjoyed it let me know. I&#8217;m looking into starting an informal iPhone Dev workshop for more topics.</p> <p><a href="http://paulsolt.com/wp-content/uploads/2009/10/iphone.jpg"></a></p> <p>Here are the slides and Xcode projects:</p> <p>Slides:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/iPhone-Development-Paul-Solt1.pdf">iPhone Development &#8211; Paul Solt</a></p> <p>1. [...]]]></description>
			<content:encoded><![CDATA[<p>Today I gave a presentation on iPhone Development at RIT for the Computer Science Community (<a title="Computer Science Community" href="http://csc.cs.rit.edu/">CSC</a>).If you enjoyed it let me know. I&#8217;m looking into starting an informal iPhone Dev workshop for more topics.</p>
<p><a href="http://paulsolt.com/wp-content/uploads/2009/10/iphone.jpg"><img class="aligncenter size-full wp-image-355" title="iphone" src="http://paulsolt.com/wp-content/uploads/2009/10/iphone.jpg" alt="iphone" width="337" height="400" /></a></p>
<p>Here are the slides and Xcode projects:</p>
<p>Slides:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/iPhone-Development-Paul-Solt1.pdf">iPhone Development &#8211; Paul Solt</a></p>
<p>1. Demo: Hello World Pusher:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/Foo2.zip">Foo2</a></p>
<p>2. Demo: Touch Input:  <a href="http://paulsolt.com/wp-content/uploads/2009/10/Stalker.zip">Stalker</a></p>
<p>3. Demo: Robot Remote Control:  See my previous <a title="iPhone Remote Control" href="http://paulsolt.com/2009/08/iphone-playerstage-remote-control/">post</a></p>
<p>*The Touch Input demo was based on a demo given during the Stanford iPhone courses available on iTunes <a title="Stanford iPhone Course" href="http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.2024353965.02024353968.2024239964?i=1439008681">here</a>.</p>
<p><strong>Resources:</strong></p>
<ul>
<li>Cocoa Programming for Mac OS X by Aaron Hillegass (Third Edition)</li>
<li>Stanford iPhone Course (<a href="http://cs193p.stanford.edu/">cs193p.stanford.edu</a>)
<ul>
<li>Search “iPhone Application Programming” in iTunes</li>
</ul>
</li>
<li>Beginning iPhone 3 Development: Exploring the iPhone SDK by Jeff LaMarche
<ul>
<li>Blog: <a href="http://iphonedevelopment.blogspot.com"> iphonedevelopment.blogspot.com</a></li>
</ul>
</li>
<li>iPhone Dev Center
<ul>
<li><a href="http://developer.apple.com/iphone">developer.apple.com/iphone</a></li>
</ul>
</li>
</ul>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-2182421302031373";
/* Large Post Ad */
google_ad_slot = "4358587115";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/10/iphone-development-talk/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>iPhone Player/Stage Remote Control</title>
		<link>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/</link>
		<comments>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:28:44 +0000</pubDate>
		<dc:creator>Paul Solt</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[player/stage]]></category>
		<category><![CDATA[remote control]]></category>
		<category><![CDATA[robotics]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://paulsolt.com/?p=329</guid>
		<description><![CDATA[<p>Here&#8217;s the iPhone Player/Stage Remote Control project! There&#8217;s a .pdf that describes how to setup Xcode in the .zip file.</p> <p style="text-align: center;"> <p>The goal of this project was to use the Player/Stage robotics code on the iPhone to communicate and control robots. I discuss how to setup the Xcode development environment. There are two [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the iPhone Player/Stage Remote Control project! There&#8217;s a .pdf that describes how to setup Xcode in the .zip file.</p>
<p style="text-align: center;">
<div id="attachment_456" class="wp-caption aligncenter" style="width: 549px"><a href="http://paulsolt.com/wp-content/uploads/2009/08/RRemoteiPhone.png"><img class="size-full wp-image-456 " title="RRemoteiPhone" src="http://paulsolt.com/wp-content/uploads/2009/08/RRemoteiPhone.png" alt="" width="539" height="290" /></a><p class="wp-caption-text">Controlling a Robot over Wi-Fi</p></div>
<div id="attachment_455" class="wp-caption aligncenter" style="width: 506px"><a href="http://paulsolt.com/wp-content/uploads/2009/08/PlayerStage.png"><img class="size-full wp-image-455 " title="PlayerStage" src="http://paulsolt.com/wp-content/uploads/2009/08/PlayerStage.png" alt="" width="496" height="510" /></a><p class="wp-caption-text">A Virtual Robot in a Virtual World</p></div>
<p>The goal of this project was to use the Player/Stage robotics code on the iPhone to communicate and control robots. I discuss how to setup the  Xcode development environment. There are two example Xcode projects. The first one is an Objective-C project that wraps around the C++ Player/Stage code. The second project is a very primitive C++ program running on the iPhone without any UI. Both of these Xcode projects are fully documented and will serve as a starting point to iPhone Player/Stage development.</p>
<p>iPhone Player/Stage Remote Control Project: <a href="http://paulsolt.com/wp-content/uploads/2009/08/iPhonePlayerStage.zip">iPhonePlayerStage</a></p>
<p>Feel free to ask questions and let me know how you use the code.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-2182421302031373";
/* Large Post Ad */
google_ad_slot = "4358587115";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://paulsolt.com/2009/08/iphone-playerstage-remote-control/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

