<?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>Luis de la Rosa &#187; iPhone</title>
	<atom:link href="http://www.luisdelarosa.com/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.luisdelarosa.com</link>
	<description>iPhone, iPad and Mac OS X Programming (with a dash of Ruby)</description>
	<lastBuildDate>Fri, 13 Jan 2012 06:53:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>C4[3] Blitz Talks and MacRuby</title>
		<link>http://www.luisdelarosa.com/2009/09/30/c43-blitz-talks-and-macruby/</link>
		<comments>http://www.luisdelarosa.com/2009/09/30/c43-blitz-talks-and-macruby/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 05:54:19 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=399</guid>
		<description><![CDATA[I just came back from C4[3] &#8211; an Independent Mac and iPhone Developer Conference in Chicago. Wolf and Victoria host it and I saw Daniel Jalkut helping out along with a few other folks. In case you&#8217;re not hip to &#8230; <a href="http://www.luisdelarosa.com/2009/09/30/c43-blitz-talks-and-macruby/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just came back from <a href="http://rentzsch.com/c4/threeOpen">C4[3]</a> &#8211; an Independent Mac and iPhone Developer Conference in Chicago.  <a href="http://rentzsch.com/">Wolf</a> and <a href="http://violasong.com/blog/">Victoria</a> host it and I saw <a href="http://www.red-sweater.com/blog/">Daniel Jalkut</a> helping out along with a few other folks.  In case you&#8217;re not hip to the zero numbering scheme, this is actually the 4th iteration of the conference.  <a href="http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/">I went last year to C4[2]</a> and this year was even better in my opinion.</p>
<p>There&#8217;s too many things to write about so I&#8217;ll just focus on two things that stick out in my mind: Blitz Talks and <a href="http://www.macruby.org/">MacRuby</a>.</p>
<p>I go to <a href="http://www.nscodernightdc.com/">NSCoderNightDC</a> and we have a nice core group of Mac and iPhone Devs who show up every week and eat Strawberry Napoleons.  We also code and talk about design.  Well 3 of the guys proposed Blitz Talks and got accepted.</p>
<p><a href="http://robrhyne.com/">Rob</a> hit it out of the park with his <a href="http://giveabrief.com/">Briefs iPhone prototyping tool</a>.  Jose actually created a Brief on the way from the airport to the hotel.  He was kinda nervous beforehand in the hotel room but he practiced his presentation a few times on me and was really well prepared.  His slides were top-notch but I think the idea is what really captivates people.  I&#8217;m personally a big fan of fake-powered prototypes &#8211; prototypes powered by objects that return canned responses, but I&#8217;m definitely going to try out Briefs on upcoming iPhone engagements.</p>
<p><a href="http://greenmango.org/">Jose</a> did well with his presentation about the different types of contexts that an iPhone user would use different apps in.  I&#8217;ve seen him give this talk before so it was interesting to see how he pared it down to fit in the much tighter 5 minute time frame.</p>
<p><a href="http://stationinthemetro.com/">Mark</a> gave an interesting talk about how to do video right for Mac and iPhone screencasts and demos.  I have a lot to learn about this and I&#8217;m hoping to work with Mark on a screencast sometime in the near future for Webnote.</p>
<p>There were many other Blitz Talks and I think they really were a nice Change of Pace that I haven&#8217;t seen in other conferences.  Wolf amped it up even further by providing an animated radar / pie that kept filling up as the talk progressed.</p>
<p>MacRuby was the other big surprise for me.  I had been tracking RubyCocoa and had seen the early MacRuby demo at RubyConf 2007.  I&#8217;m a former Smalltalker and current Rubyist.  I do all my automated build processes in Ruby and I&#8217;ve also created various non-Rails Ruby server-side components for clients.  Plus I did Ruby on Rails for a few years.  So I&#8217;ve been wanting to make Mac apps with Ruby, except one thing kept holding me back: I don&#8217;t want to show everyone my source.</p>
<p>Obfuscation is not a problem with server-side Ruby.  The users only see what you expose via the web or other ports.  They only see what&#8217;s rendered to them or the API that you expose.</p>
<p>Client-side Ruby is another world altogether.  Users learn that they can peek inside application packages and if you&#8217;re writing Ruby, they can see your source.  I&#8217;ve asked this question at WWDCs in the past and the answer was usually that its not a big deal and that you should just keep innovating.  But we don&#8217;t just leave our Objective-C sources lying around, do we?</p>
<p>MacRuby will soon solve that, or I hope it will, with his AOT (Ahead Of Time) compiler.  Or as it is known in the C/C++/Objective-C world: a compiler.  LOL.  So with the AOT, we will be able to write Cocoa apps in Ruby, compile them and run them on Mac.  (And maybe iPhone &#8211; the jury is still out on that.)  Which means that people can&#8217;t just look at your Ruby source.  Even better, there is the HotCocoa project which provides useful macros / shortcuts for common Cocoa idioms.</p>
<p>Why use Ruby to write Cocoa apps?  Ruby can be more concise, there are more libraries to choose from and the testing/mocking frameworks are better.  On the other hand, the debugging story is still hazy.</p>
<p>I&#8217;ll be trying out MacRuby soon and I&#8217;ll post what I find.  They&#8217;re currently at 0.4 with a 0.5 on the horizon, with nightlies for Snow Leopard available and the latest source available in both Subversion and Git.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/09/30/c43-blitz-talks-and-macruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhoneDevCampDC is coming July 31st &#8211; August 1st!</title>
		<link>http://www.luisdelarosa.com/2009/06/25/iphonedevcampdc-is-coming-july-31st-august-1st/</link>
		<comments>http://www.luisdelarosa.com/2009/06/25/iphonedevcampdc-is-coming-july-31st-august-1st/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 06:18:44 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Northern Virginia]]></category>
		<category><![CDATA[Washington DC]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=392</guid>
		<description><![CDATA[We are putting together a local gathering of iPhone developers in the Washington DC area. Its called iPhoneDevCampDC and it is a satellite event of the main iPhoneDevCamp (which is in Sunnyvale, CA.) There are satellite events all over the &#8230; <a href="http://www.luisdelarosa.com/2009/06/25/iphonedevcampdc-is-coming-july-31st-august-1st/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We are putting together a local gathering of iPhone developers in the Washington DC area.  Its called <a href="http://iphonedevcampdc.com">iPhoneDevCampDC</a> and it is a satellite event of the main <a href="http://iphonedevcamp.org">iPhoneDevCamp</a> (which is in Sunnyvale, CA.)  There are satellite events all over the country and Washington DC is one of the new ones in this third iteration.  <a href="http://iphonedevcampfl.org/">iPhoneDevCamp Florida</a>, by the way, is another new one &#8211; go East Coast!</p>
<p>iPhoneDevCampDC is going to be the evening of July 31st and then all day August 1st.  We are looking for sponsors for the event, so if you are looking to get your company in front of iPhone developers, <a href="mailto:iphonedevcampdc@luisdelarosa.com">please contact us</a>.</p>
<p>We will be limiting the number of attendees this year to 50.  Ticket registration will start next week around the beginning of July.  This is a BarCamp-style conference, where the attendees present the sessions, so if you&#8217;re planning to attend, start thinking of what session you could present.  We won&#8217;t have time for everyone to present, but if everyone comes ready, then we&#8217;ll have great topics for everyone to choose from.</p>
<p>There&#8217;s a <a href="http://iphonedevcampdc.com">website for iPhoneDevCampDC</a> with some more details and we&#8217;ve also started tweeting at <a href="http://twitter.com/iphonedevcampdc">@iphonedevcampdc</a>, where we&#8217;ll publish news about the event (like when registration starts.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/06/25/iphonedevcampdc-is-coming-july-31st-august-1st/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Three things I learned at WWDC 2009</title>
		<link>http://www.luisdelarosa.com/2009/06/19/three-things-i-learned-at-wwdc-2009/</link>
		<comments>http://www.luisdelarosa.com/2009/06/19/three-things-i-learned-at-wwdc-2009/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:26:44 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[wwdc]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=388</guid>
		<description><![CDATA[I went to WWDC 2009 last week and I learned 100 things. Unfortunately, 97 of them are under NDA, so I&#8217;ll just share with you three things that aren&#8217;t secret. 1. When in doubt, file a bug. Mac OS X &#8230; <a href="http://www.luisdelarosa.com/2009/06/19/three-things-i-learned-at-wwdc-2009/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I went to WWDC 2009 last week and I learned 100 things.  Unfortunately, 97 of them are under NDA, so I&#8217;ll just share with you three things that aren&#8217;t secret.</p>
<p><strong>1. When in doubt, file a bug.</strong><br />
<em>Mac OS X and iPhone to some extent are a democracy, where bugs count as votes.</em>  Apple uses your bug filings to see which things should get fixed and which things should get implemented.  I&#8217;d say at least half of the Q&#038;A could be summed up by: &#8220;Please file a bug.&#8221;</p>
<p>At first it seems like the Apple Engineers are just passing the buck, but really what they&#8217;re saying is either:<br />
a. &#8220;Yes that seems like a good idea, but I need you to file a bug so I can justify working on this, be it a bug or a new feature, to my manager.&#8221; or<br />
b. &#8220;I&#8217;m not sure about that, but file a bug and if we get enough of those, we&#8217;ll work on it.&#8221;</p>
<p>BTW here&#8217;s <a href="https://bugreport.apple.com/">how to file a bug in Apple&#8217;s Radar bug database.</a></p>
<p><strong>2. Instruments is as important as Xcode and Interface Builder.</strong><br />
Every Mac and iPhone Developer is familiar with Xcode and Interface Builder.  But Instruments is just as important, especially with the relatively limited hardware of the 1st gen/3G iPhone and 1st gen iPod Touch.  There were a lot of good sessions that featured Instruments that are worth watching when the session videos come out.</p>
<p>Even on Mac OS X, profiling your application to improve its performance and memory usage is important to do with Instruments.</p>
<p>Another interesting tool to delve into is dtrace.  Its the technology that underlies some of the instruments in Instruments.</p>
<p>Also I heard a new phrase <em>&#8220;There&#8217;s an Instrument for that.&#8221;</em>  If you have access to the Snow Leopard betas (and you should get it via ADC), then check out the new ones that are available.  If you don&#8217;t see one that fits your needs, you might consider filing a bug requesting it.</p>
<p><strong>3. WWDC 2010 will hopefully occur in a bigger venue.</strong><br />
WWDC 2009 sold out the fastest as I&#8217;ve seen any (and perhaps the fastest ever?)  60% of attendees were new attendees.  So there&#8217;s still another 3000 or so people who were at WWDC 2008 and previously that might have attended if they had purchased their tickets sooner.  Add to that another 2000 or so developers that see the market growing due to the $99 iPhone and you&#8217;re over 10,000 developers that could be attending WWDC 2010.  That&#8217;s roughly double the attendance.</p>
<p>OK I admit that I don&#8217;t really like lines and such, but the keynote line ran completely around the block back to the front!  <em>Moscone West was just overflowing with Mac and iPhone developers this year.</em>  I&#8217;m hoping that next year&#8217;s WWDC 2010 will be say in Moscone South or Moscone North.  It might not be as cozy but it should give some breathing space and allow for more developers (including those who have longer purchasing cycles) to attend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/06/19/three-things-i-learned-at-wwdc-2009/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to use TouchJSON in your iPhone Apps</title>
		<link>http://www.luisdelarosa.com/2009/04/25/how-to-use-touchjson-in-your-iphone-apps/</link>
		<comments>http://www.luisdelarosa.com/2009/04/25/how-to-use-touchjson-in-your-iphone-apps/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 06:48:11 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSCoderNightDC]]></category>
		<category><![CDATA[TouchJSON]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=370</guid>
		<description><![CDATA[I gave a presentation at NSCoderNightDC a week ago on &#8220;How to use TouchJSON in your iPhone Apps.&#8221; It was great fun and we had a little iChat Screen Sharing session going on with Rob aka @capttaco so that everyone &#8230; <a href="http://www.luisdelarosa.com/2009/04/25/how-to-use-touchjson-in-your-iphone-apps/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I gave a presentation at <a href="http://nscodernightdc.com/">NSCoderNightDC</a> a week ago on &#8220;How to use TouchJSON in your iPhone Apps.&#8221;  It was great fun and we had a little iChat Screen Sharing session going on with <a href="http://robrhyne.com/">Rob</a> aka <a href="http://twitter.com/capttaco">@capttaco</a> so that everyone could see.<br />
<a href="http://nscodernightdc.com/presentations/How%20to%20use%20TouchJSON%20in%20your%20iPhone%20apps.pdf"><img src="http://nscodernightdc.com/presentations/TouchJSONPresentationFront.png" alt="TouchJSON Presentation First Slide" width="512"/></a></p>
<p>If you missed it, you can still get the slides: &#8220;<a href="http://nscodernightdc.com/presentations/How%20to%20use%20TouchJSON%20in%20your%20iPhone%20apps.pdf">How to use TouchJSON in your iPhone Apps</a>&#8220;.<br />
As an added bonus, I also uploaded <a href="http://github.com/luisdelarosa/touchjson-iphonedemo/tree/master">the sample iPhone project which shows how to search Twitter using TouchJSON</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/04/25/how-to-use-touchjson-in-your-iphone-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pitfalls That You May Encounter when Running iPhone Unit Tests and How to Overcome Them</title>
		<link>http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them/</link>
		<comments>http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 03:43:00 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[lessons_learned]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit_tests]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=345</guid>
		<description><![CDATA[We have come to the last part of this series on iPhone Unit Testing. In this post we will cover pitfalls that you may encounter when running iPhone unit test and how to overcome each of them. Pitfall: You may &#8230; <a href="http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We have come to the last part of this series on iPhone Unit Testing.  In this post we will cover pitfalls that you may encounter when running iPhone unit test and how to overcome each of them.</p>
<p>Pitfall: You may get this message in the Build Results: &#8220;Couldn&#8217;t register PurpleSystemEventPort with the bootstrap server. Error: unknown error code.</p>
<p>Overcome it by: This generally means that another instance of this process was already running or is hung in the debugger.&#8221;<br />
If you get this, it just means that the iPhone Simulator is already running.  Quit the Simulator and then run your tests again.</p>
<p>Pitfall: You get the error &#8220;Unable to send CPDistributedMessagingCenter message named SBRemoteNotificationClientStartedMessage to com.apple.remotenotification.server: (ipc/send) invalid destination port&#8221;.</p>
<p>Open up the &#8220;Tests&#8221; target by double-clicking on it, go to the Properties tab and clear out the Main Nib File text field.</p>
<p>Pitfall: XCode is not executing any of your unit tests.  Instead it hangs at the line: &#8220;Running 1 of 1 custom shell scripts&#8230;&#8221;</p>
<p>Open up your Tests target, go to the Properties tab and clear out the Main Nib field.  Do a Clean All.  Then Build and your tests should run.</p>
<p>Since we discussed clearing out the Main Nib text field twice here, I think we should discuss why this would work.  It will give us insight into how the Google Toolbox for Mac unit testing framework operates.</p>
<p>What I think it is related to is the Main Nib loading and that Nib having an App Delegate which implements applicationDidFinishLaunching.  This sometimes causes everything to not work because GTMIPhoneUnitTestDelegate&#8217;s applicationDidFinishLaunching not to get called &#8211; and this is what runs the tests.  Clearing out the Main Nib field will cause this potential collision to not occur and GTMIPhoneUnitTestDelegate will function properly by finding and running your unit tests.</p>
<p>Have you had run into any other pitfalls while doing iPhone Unit Testing?  If so, feel free to leave a comment here.  I also encourage you to visit <a href="http://groups.google.com/group/google-toolbox-for-mac">the Google Toolbox for Mac discussion group on Google</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started Writing iPhone Unit Tests</title>
		<link>http://www.luisdelarosa.com/2009/02/21/getting-started-writing-iphone-unit-tests/</link>
		<comments>http://www.luisdelarosa.com/2009/02/21/getting-started-writing-iphone-unit-tests/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 07:32:26 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[lessons_learned]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit_tests]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=324</guid>
		<description><![CDATA[Alright, well hopefully you have read the first two parts of this series. If not, then go back and read Is iPhone Unit Testing Possible? and How to Create an iPhone Project in Xcode That Can Run Unit Tests. Make &#8230; <a href="http://www.luisdelarosa.com/2009/02/21/getting-started-writing-iphone-unit-tests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Alright, well hopefully you have read the first two parts of this series.  If not, then go back and read <a href="http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/">Is iPhone Unit Testing Possible?</a> and <a href="http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/">How to Create an iPhone Project in Xcode That Can Run Unit Tests</a>.</p>
<p>Make sure that you have an iPhone Project that is already set up for unit testing.  You can either follow the steps in those last two posts or you can download <a href="http://github.com/luisdelarosa/iphone_unit_testing/zipball/master">a pre-made &#8220;example1&#8243; iPhone Project that can run unit tests</a> that I uploaded to GitHub.</p>
<p>In this tutorial, I will be showing you, the iPhone Developer, how to get started writing unit tests for your iPhone App.  I will be doing this in the TDD style &#8211; where TDD == Test-Driven Development.  In other words, we will write the tests first.  You don&#8217;t have to do it this way, but I thought I&#8217;d show it to you since it is a nice practice that was ingrained in me from the Ruby on Rails community.  This is not to say that it started in Rails &#8211; it really started back in the Smalltalk days with Kent Beck and the other original XPers (eXtreme Programming).  But being involved in the Smalltalk, Java, Objective-C and Ruby communities in my career since 1995, I haven&#8217;t been seen such testing dedication as I have in the Ruby on Rails community.  I hope it is something that really spreads in iPhone community as well.</p>
<p>So, how do we get started?  Or in TDD-speak, how do we write our first failing test?  You write failing tests first as sort of a TODO to yourself as a programmer.  When you get it to pass, then you can mark off your TODO, but in a nice programmatic way.</p>
<p>You will need to create a Test Class.  Then you&#8217;ll add a Test Method.  This should reference a non-existent Class, which you&#8217;ll then proceed to flesh out.  This is the classic Test Driven-Development (TDD) way of testing.</p>
<p>Create a new group with Project > New Group.  Name this new group &#8220;Tests&#8221;.</p>
<p>Create a new Test Class with File > New File&#8230; and choose Cocoa Touch Classes / NSObject subclass.</p>
<p>Name your class &#8220;FooTest.m&#8221;.  Make sure that it is only a member of the Tests target.</p>
<p>Run the tests now by pressing the Build button.  Make sure that the &#8220;Tests&#8221; target is selected in the Active Target dropdown and &#8220;Simulator&#8221; is chosen a the Active SDK.  Notice that the Test Class isn&#8217;t being included yet:</p>
<p><code>
<pre>
Test Suite '/Users/louie/builds/Debug-iphonesimulator/Tests.app' started at 2009-02-19 14:43:32 -0500
Test Suite 'SenTestCase' started at 2009-02-19 14:43:32 -0500
Test Suite 'SenTestCase' finished at 2009-02-19 14:43:32 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'GTMTestCase' started at 2009-02-19 14:43:32 -0500
Test Suite 'GTMTestCase' finished at 2009-02-19 14:43:32 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite '/Users/louie/builds/Debug-iphonesimulator/Tests.app' finished at 2009-02-19 14:43:32 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
</pre>
<p></code></p>
<p>This Test Class doesn&#8217;t know it is supposed to contain tests yet.  Let us change that.</p>
<p>Change the import statements to include &#8220;GTMSenTestCase.h&#8221;  This is the Google Toolbox for Mac version of SenTestCase.  This enables your test cases to be found by the GTM RunIPhoneUnitTest script.  It also adds some additional capabilities we will cover later.</p>
<p>Change the superclass to be &#8220;SenTestCase.&#8221;</p>
<p>Your class header FooTest.h should now look like:</p>
<p><code>
<pre>
#import "GTMSenTestCase.h"

@interface FooTest : SenTestCase {

}

@end
</pre>
<p></code></p>
<p>If you run the tests now, you&#8217;ll see that FooTest is now being included:</p>
<p><code>
<pre>
Test Suite '/Users/louie/builds/Debug-iphonesimulator/Tests.app' started at 2009-02-19 14:44:30 -0500
Test Suite 'SenTestCase' started at 2009-02-19 14:44:30 -0500
Test Suite 'SenTestCase' finished at 2009-02-19 14:44:30 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'FooTest' started at 2009-02-19 14:44:30 -0500
Test Suite 'FooTest' finished at 2009-02-19 14:44:30 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'GTMTestCase' started at 2009-02-19 14:44:30 -0500
Test Suite 'GTMTestCase' finished at 2009-02-19 14:44:30 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite '/Users/louie/builds/Debug-iphonesimulator/Tests.app' finished at 2009-02-19 14:44:30 -0500.
Executed 0 tests, with 0 failures (0 unexpected) in 0.002 (0.002) seconds
</pre>
<p></code></p>
<p>However, with 0 tests, FooTest is pretty boring.  Let&#8217;s spice up FooTest.  Switch over to FooTest.m.  You can quickly do this with the keyboard shortcut Command + Option + up arrow.</p>
<p>Now add a Test Method.  Test Methods are where the work happens with testing.  They must start with &#8220;test&#8221; and the first character of &#8220;test&#8221; must be a lowercase &#8220;t&#8221; in order to be found by the test runner script.
</p>
<p>Add this piece of code:</p>
<p><code>
<pre>
- (void)testBar {
	Foo *instance = [[[Foo alloc] init] autorelease];
	STAssertEquals(@"bar", [instance bar], nil);
}
</pre>
<p></code></p>
<p>Try to Build.  You&#8217;ll get 3 errors.  They all relate to Foo not being declared in FooTest.  This actually is good!  Well, in the classic TDD sense.  What we have done is written what we want to happen when a client calls Foo and what the client expects back when it calls the bar method of Foo.  Specifically, we want it to return the NSString @&#8221;bar&#8221;.  This can also serve as good documentation for future programmers who are inspecting this code to see an example of how to use Foo.
</p>
<p>Now let us fix these errors:</p>
<p>Select the Classes group.<br />
Create a new Class with File > New File&#8230; and choose Cocoa Touch Classes / NSObject subclass.  Yes, this is just like how we created a new Test Class.  They are the same because we haven&#8217;t created a new template for a Test Class.</p>
<p>Name your new class &#8220;Foo&#8221;.</p>
<p>Make sure that it is a member of both of the targets &#8220;example1&#8243; and &#8220;Tests&#8221;.  The reason we want this is because Foo should exist in the main application but also should be available for testing.  Going back, we can see that FooTest was only in the Tests target because we don&#8217;t want to ship our tests with the application.  This will make it lighter and thus quicker to download when a user decides to purchase it from the App Store.  Quicker downloads should mean a quicker path to riches! :)</p>
<p>Now try building again.  Still 3 errors?  Yes, because we need to make Foo known to FooTest.</p>
<p>Go to FooTest.h and add the line:</p>
<p><code>
<pre>
#import "Foo.h"
</pre>
<p></code></p>
<p>Now build again.  You should have two errors now and four warnings.</p>
<p>Now Xcode tells you that &#8220;warning: &#8216;Foo&#8217; may not respond to &#8216;-bar&#8217;.&#8221;  Again this seems wrong, but this is actually a good thing with classic TDD.  This just means that we need to declare the method bar.  So let us do just that.</p>
<p>Go to Foo.h.</p>
<p>Add the method declaration:</p>
<p><code>
<pre>
- (NSString *)bar;
</pre>
<p></code></p>
<p>Go to Foo.m.</p>
<p>Add the method implementation:</p>
<p><code>
<pre>
- (NSString *)bar {
	return @"bar";
}
</pre>
<p></code></p>
<p>Now build and you have success!  This is known in TDD-speak as &#8220;green bar.&#8221;  When you had failures due to errors/warnings, that was &#8220;red bar.&#8221;  This had to do with the graphical indicators of the tools at the dawn of TDD.  We can just call them &#8220;success&#8221; and &#8220;having test failures.&#8221;</p>
<p>This method is what I&#8217;ve used over the past year to help ensure good code quality in that iPhone apps I have built for my consulting clients.  At this point, you know enough to be able to write unit tests, the iPhone way with the help of Google Toolbox for Mac.  You can start to use more generic unit testing techniques that you may have used in other languages.  There are also some iPhone-specific testing techniques that I will cover in the future if people are interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/02/21/getting-started-writing-iphone-unit-tests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Create an iPhone Project in Xcode That Can Run Unit Tests</title>
		<link>http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/</link>
		<comments>http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 05:52:54 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[lessons_learned]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit_tests]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=293</guid>
		<description><![CDATA[This is the second part of a blog series I am writing on How to Do iPhone Unit Testing or Lessons Learned from Unit Testing iPhone Apps. I am targeting this at iPhone Developers. Â My aim is to take you &#8230; <a href="http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the second part of a blog series I am writing on How to Do iPhone Unit Testing or Lessons Learned from Unit Testing iPhone Apps.</p>
<p>I am targeting this at iPhone Developers. Â My aim is to take you step by step through the process of setting up an iPhone Project in Xcode that lets you run unit tests. Â There are other guides out there but I&#8217;d like to make this very visual and easy.</p>
<p>So let&#8217;s get to the question:</p>
<p>How do I set up an iPhone project that lets me unit test my app?</p>
<p><strong>Step 1: Â Create a New iPhone Project</strong></p>
<p>Create a new project via File &gt; New Project. Â Choose &#8220;View-Based Application&#8221; (you can choose any, but we&#8217;ll use this type here.) Â Name your project &#8220;example1&#8243; to follow along with this tutorial.</p>
<p>After your project is created, it should look something like this:</p>
<p>Â </p>
<div id="attachment_295" class="wp-caption alignnone" style="width: 878px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/project_created.png"><img class="size-full wp-image-295" title="The &quot;example1&quot; project after creation." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/project_created.png" alt="The &quot;example1&quot; project after creation." width="868" height="639" /></a><p class="wp-caption-text">The &quot;example1&quot; project after creation.</p></div>
<p>Â </p>
<p>Now that you have created the project, you can add the supporting files to enable unit testing.</p>
<p><strong>Step 2: Create a Folder to Organize Your Unit Testing &#8220;Framework&#8221;</strong></p>
<p>One of the lessons learned from my iPhone consulting is that iPhone projects can get big and messy. Â It helps if you isolate your &#8220;frameworks&#8221; into folders in Finder. Â I say &#8220;frameworks&#8221; loosely because you can&#8217;t really have Mac OS X-style frameworks in your iPhone projects. Â There is no dynamic loading of libraries (which frameworks are) on the iPhone. Â Instead, you end up copying all the files into your project.</p>
<p>In this example, we will create a folder named &#8220;UnitTestingFramework&#8221; in our project to separate it from the rest of our code. Â If you&#8217;re using a lot of external code in your project, you could put this under another folder called &#8220;OpenSourceFrameworks.&#8221; Â I&#8217;ve done this in most of my consulting projects, but we&#8217;ll keep it simple since we&#8217;re only working with one &#8220;framework&#8221; in this tutorial.</p>
<p>So: In Finder, create a new Folder inside your &#8220;example1&#8243; project folder called &#8220;UnitTestingFramework.&#8221;</p>
<p>Â </p>
<div id="attachment_299" class="wp-caption alignnone" style="width: 636px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unittestingframework_folder_created.png"><img class="size-full wp-image-299" title="Create a folder named UnitTestingFramework in the example1 project folder." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unittestingframework_folder_created.png" alt="Create a folder named UnitTestingFramework in the example1 project folder." width="626" height="354" /></a><p class="wp-caption-text">Create a folder named UnitTestingFramework in the example1 project folder.</p></div>
<p>Drag and drop the &#8220;UnitTestingFramework&#8221; folder from Finder into the &#8220;example1&#8243; project in Xcode. Â When the sheet pops up, do not select &#8220;Copy items into destination group&#8217;s folder (if needed).&#8221; Â The reason is because it already is in the &#8220;example1&#8243; folder.</p>
<p>You should see a Group called &#8220;UnitTestingFramework&#8221; underneath the &#8220;example1&#8243; Project.</p>
<p>Â </p>
<div id="attachment_302" class="wp-caption alignnone" style="width: 199px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unittestingframework_group.png"><img class="size-full wp-image-302" title="You should see a UnitTestingFramework group underneath the example1 project." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unittestingframework_group.png" alt="You should see a UnitTestingFramework group underneath the example1 project." width="189" height="57" /></a><p class="wp-caption-text">You should see a UnitTestingFramework group underneath the example1 project.</p></div>
<p><strong>Step 3: Find and Install a Unit Testing Framework</strong></p>
<p>In the first post, I alluded to a group of &#8220;diligent and ingenious engineers&#8221;. Â I was specifically referring to the Google Mac Team. Â They&#8217;ve created a great project called Google Toolbox for Mac. Â It actually does a lot more than unit testing. Â For example, I used their Address Book interface to make working with Address Book on the iPhone much nicer.</p>
<p>In this tutorial, we&#8217;ll focus on one subset of <a href="http://code.google.com/p/google-toolbox-for-mac/">Google Toolbox for Mac</a>, the unit testing portion. Â We won&#8217;t even use the entire unit testing portion, since there are helpers for Mac OS X unit testing as well.</p>
<p>First, you&#8217;ll need to download the source. Â The latest stable version is their 1.5.1 from June of 2008. Â You can get it from here:Â <a href="http://google-toolbox-for-mac.googlecode.com/files/google-toolbox-for-mac-1-5-1.zip">google-toolbox-for-mac-1-5-1.zip</a></p>
<p>You could also get the latest from Subversion, but we&#8217;ll focus on the stable version for this tutorial.</p>
<p><a href="http://google-toolbox-for-mac.googlecode.com/files/google-toolbox-for-mac-1-5-1.zip"></a>Unzip the file by double-clicking on it in Finder if it wasn&#8217;t unzipped already into a folder. Â Then go into the folder and find the following 7 files:</p>
<p>GTMDefines.h</p>
<p>UnitTesting/GTMIPhoneUnitTestDelegate.h</p>
<p>UnitTesting/GTMIPhoneUnitTestDelegate.m</p>
<p>UnitTesting/GTMIPhoneUnitTestMain.m</p>
<p>UnitTesting/GTMSenTestCase.h</p>
<p>UnitTesting/GTMSenTestCase.m</p>
<p>UnitTesting/RunIPhoneUnitTest.sh</p>
<p>Â </p>
<div id="attachment_304" class="wp-caption alignnone" style="width: 1048px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unit_testing_files_to_copy.png"><img class="size-full wp-image-304" title="The 7 files you need to select from Google Toolbox for Mac." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/unit_testing_files_to_copy.png" alt="The 7 files you need to select from Google Toolbox for Mac." width="1038" height="933" /></a><p class="wp-caption-text">The 7 files you need to select from Google Toolbox for Mac.</p></div>
<p>Drag and drop those 7 selected files to the &#8220;UnitTestingFramework&#8221; group in Xcode. Â When the sheet appears, make sure to check &#8220;Copy items into destination group&#8217;s folder (if needed.)&#8221; Â This time, we need to copy them from the Google Toolbox for Mac download to our project and specifically to the UnitTestingFramework folder we created in Step 2.</p>
<p>You have all the raw ingredients now, but you will need to perform a few more steps to be able to find and run unit tests in your iPhone project.</p>
<p><strong>Step 4: Create a &#8220;Tests&#8221; Target</strong></p>
<p>Create a new target via Project &gt; New Target.</p>
<p>Choose iPhone OS &gt; Cocoa Touch &gt; Application.</p>
<p>Call it &#8220;Tests&#8221;.</p>
<p>In the first post of this series, we discussed that there are only two types of Targets available for iPhone projects. Â Applications are the only ones that can run and we want to execute our unit tests. Â That is why we are adding this new &#8220;Tests&#8221; target.</p>
<p>We are almost there. Â Now we just need to tell the &#8220;Tests&#8221; target to find and execute our unit tests.</p>
<p><strong>Step 5: Add a Run Script Build Phase to the &#8220;Tests&#8221; Target</strong></p>
<p>Select the &#8220;Tests&#8221; target.</p>
<p>Control-click (or right-click or whatever finger gestures you use on your fancy new MacBook Pro with no buttons) and select Add &gt; New Build Phase &gt; New Run Script Build Phase.</p>
<p>Enter &#8220;./UnitTestingFramework/RunIPhoneUnitTest.sh&#8221; in the Script text area. Â Note that if you had spaces in your folder, you would need to escape it with a backslash like &#8220;\ &#8221; here. Â So another lesson is to not include spaces in your folders to keep things simple.</p>
<p>Â </p>
<div id="attachment_312" class="wp-caption alignnone" style="width: 480px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/run_script_phase_for_tests_target.png"><img class="size-full wp-image-312" title="Enter &quot;./UnitTestingFramework/RunIPhoneUnitTest.sh&quot; in the Script text area." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/run_script_phase_for_tests_target.png" alt="Enter &quot;./UnitTestingFramework/RunIPhoneUnitTest.sh&quot; in the Script text area." width="470" height="673" /></a><p class="wp-caption-text">Enter &quot;./UnitTestingFramework/RunIPhoneUnitTest.sh&quot; in the Script text area.</p></div>
<p>What is this &#8220;RunIPhoneUnitTest.sh&#8221;?</p>
<p>It is a shell script that the Google Mac team has created. Â It sets up some environment variables to help with executing the unit tests. Â The real magic will be explained later in this series. Â Hint: it is in those files you selected and dragged into your project.</p>
<p><strong>Step 6: Ensure All the &#8220;UnitTestingFramework&#8221; Files Are Part of the &#8220;Tests&#8221;Â Target</strong></p>
<p>Select the &#8220;Tests&#8221; target in the Active Target portion of the Toolbar. Â You can also select in via the menu item Project &gt; Set Active Target &gt; Tests. Â Ensure tha the Active Build Configuration is Debug and the Active SDK is Simulator.</p>
<p>Select the UnitTestingFramework group. Â Look at the list on the right side and make sure that all the *.m files are checked. Â This ensures that they will be included in the Tests target. Â Check any that are unchecked.</p>
<p>Note that you&#8217;ll want to make sure these are all unchecked in your &#8220;example1&#8243; target as well. Â You don&#8217;t need these testing &#8220;framework&#8221; files in your regular application target.</p>
<p>Â </p>
<div id="attachment_313" class="wp-caption alignnone" style="width: 878px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/select_all_unittestingframework_files_for_tests_target.png"><img class="size-full wp-image-313" title="Check all the UnitTestingFramework *.m files for the Tests target." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/select_all_unittestingframework_files_for_tests_target.png" alt="Check all the UnitTestingFramework *.m files for the Tests target." width="868" height="639" /></a><p class="wp-caption-text">Check all the UnitTestingFramework *.m files for the Tests target.</p></div>
<p>Â </p>
<p><strong>Step 7: Run the Tests and Verify Success</strong></p>
<p>At this point, the project is fully set up to run unit tests for an iPhone project. Â To verify this, press the Build button on the toolbar or use the menu item Build &gt; Build.</p>
<p>Open up the Build Results so you can see the progress. Â You can use the menu item Build &gt; Build Results.</p>
<p>To better see the progress, you will want to look at the detailed Build Transcript. Â To see this, you&#8217;ll need to click on the little transcript icon in the Build Results window.</p>
<p>Â </p>
<div id="attachment_309" class="wp-caption alignnone" style="width: 277px"><a href="http://www.luisdelarosa.com/wp-content/uploads/2009/02/build_transcript_button.png"><img class="size-full wp-image-309" title="Click on the Build Transcript button to see the details of the unit tests progress." src="http://www.luisdelarosa.com/wp-content/uploads/2009/02/build_transcript_button.png" alt="Click on the Build Transcript button to see the details of the unit tests progress." width="267" height="50" /></a><p class="wp-caption-text">Click on the Build Transcript button to see the details of the unit tests progress.</p></div>
<p>You should see: (give or take a few miliseconds)</p>
<p>&#8220;Executed 0 tests, with 0 failures (0 unexpected) in 0.004 (0.004) seconds&#8221;.</p>
<p>This is success! Â Your project is set up correctly. Â We have no tests yet. Â We will cover that tomorrow. Â But this shows that the unit testing &#8220;framework&#8221; is running correctly. Â If we did have any tests, they would execute and show in the Build Details.</p>
<p>If you don&#8217;t see this, don&#8217;t worry &#8211; try reading part 4 of this series: <a href="http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them">Pitfalls That You May Encounter when Running iPhone Unit Tests and How to Overcome Them.</a> Â You can also visit the <a href="http://groups.google.com/group/google-toolbox-for-mac">Google Toolbox for Mac Google Group</a> for support via an email discussion list.</p>
<p>Note that the results were reported twice &#8211; this is a known bug in 1.5.1 and is fixed in a later version.</p>
<p>You can see the completed version of this project atÂ <a href="http://github.com/luisdelarosa/iphone_unit_testing">http://github.com/luisdelarosa/iphone_unit_testing</a>. Â That&#8217;s sort of like when you see a chef pull out a fully cooked pie at the end of Â cooking show.</p>
<p>If you have any questions about this tutorial, let me know in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Is iPhone Unit Testing Possible?</title>
		<link>http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/</link>
		<comments>http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 20:03:42 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[lessons_learned]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[unit_tests]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/?p=276</guid>
		<description><![CDATA[Lessons Learned: Unit Testing iPhone Apps This is the first part of a four part series on How to do iPhone Unit Testing. You could also call it Lessons Learned from Unit Testing iPhone Apps. I&#8217;ve learned a lot of &#8230; <a href="http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lessons Learned: Unit Testing iPhone Apps</p>
<p>This is the first part of a four part series on How to do iPhone Unit Testing.  You could also call it Lessons Learned from Unit Testing iPhone Apps.  I&#8217;ve learned a lot of lessons over the past year doing iPhone Consulting and I want to share them with everyone.</p>
<p>Here is the schedule for this series:</p>
<ol>
<li>Is iPhone Unit Testing Possible?</li>
<li><a href="http://www.luisdelarosa.com/2009/02/19/how-to-create-an-iphone-project-in-xcode-that-can-run-unit-tests/">How to Create an iPhone Project in Xcode That Can Run Unit Tests</a></li>
<li><a href="http://www.luisdelarosa.com/2009/02/21/getting-started-writing-iphone-unit-tests/">Getting Started Writing iPhone Unit Tests</a></li>
<li><a href="http://www.luisdelarosa.com/2009/02/21/pitfalls-that-you-may-encounter-when-running-iphone-unit-tests-and-how-to-overcome-them/">Pitfalls That You May Encounter when Running iPhone Unit Tests and How to Overcome Them</a></li>
</ol>
<p>This is targeted at iPhone Developers, especially those who have done unit testing in other languages and frameworks.</p>
<p>A bit of backstory: My name is Luis de la Rosa and I am an iPhone Consultant.  I have been <a href="http://www.happyapps.com/consulting/">making iPhone applications for clients the past year through my company Happy Apps LLC</a>.  I have also been developing Mac OS X apps and Rails apps for the past 3 1/2 years and in other languages for 14+ years now.</p>
<p>To start off, you might ask: Is iPhone Unit Testing even possible?  I don&#8217;t see it as an option when creating a New Target in Xcode like I can with Mac OS X applications.</p>
<p>Apple says it is not possible.  In the &#8220;Xcode Unit Testing Guide&#8221;, it says <a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTesting/Articles/CreatingTests.html#//apple_ref/doc/uid/TP40002171"></p>
<blockquote><p>&#8220;iPhone OS Unit Testing Support: Unit tests are not supported for iPhone applications.&#8221;Â </p>
</blockquote>
<p></a></p>
<p><a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTesting/Articles/CreatingTests.html#//apple_ref/doc/uid/TP40002171"></a></p>
<p>But what this really means is that Unit Test Bundles, which are dynamic, are not allowed on iPhone because dynamic bundles of all kinds are not allowed on iPhone.  So the normal way of adding Unit Tests to an Xcode project is not available to you.  (iPhone projects are Xcode projects.)</p>
<p>However, there is a way to add unit tests to an iPhone project!</p>
<p>To understand why, you need to understand the two types of targets available to an iPhone project.  These two are:</p>
<ol>
<li>Application</li>
<li>Static Library</li>
</ol>
<p>To put it another way: the normal Unit Test Bundle target for Mac OS X applications is not available because there are no Dynamic Bundle targets.  A Static Library target cannot be executed and we need some sort of execution in order to run the tests.  So we need to somehow use an Application target to run our unit tests.</p>
<p>The Application target will need to do the following things:</p>
<ol>
<li>Find all the unit tests in your Project</li>
<li>Run all the unit tests</li>
<li>Report the results of running the unit tests.  This should include the number of successes and failures overall and also the results of each individual test.</li>
</ol>
<p>You could do this from scratch, but fortunately there are already some diligent and ingenious engineers out there who have already done the work for you.</p>
<p>In tomorrow&#8217;s segment: How to create an iPhone Project in Xcode that can run unit tests.</p>
<p>If you found this helpful and/or interesting (hopefully both), please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NSCoderNightDC is going to be studying iPhone SDK Development</title>
		<link>http://www.luisdelarosa.com/2008/10/07/nscodernightdc-is-going-to-be-studying-iphone-sdk-development/</link>
		<comments>http://www.luisdelarosa.com/2008/10/07/nscodernightdc-is-going-to-be-studying-iphone-sdk-development/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 19:15:01 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Washington DC]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/2008/10/07/nscodernightdc-is-going-to-be-studying-iphone-sdk-development/</guid>
		<description><![CDATA[NSCoderNight DC is going to be switching gears tonight and starting to study the new Beta Book from the Pragmatic Programmers titled iPhone SDK Development. Why the switch? Because the NDA has been lifted. It is the first book of &#8230; <a href="http://www.luisdelarosa.com/2008/10/07/nscodernightdc-is-going-to-be-studying-iphone-sdk-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>NSCoderNight DC is going to be switching gears tonight and starting to study the new Beta Book from the Pragmatic Programmers titled <a href="http://pragprog.com/titles/amiphd/iphone-sdk-development">iPhone SDK Development</a>.  Why the switch?  Because the NDA has been lifted.</p>
<p>It is the first book of its kind that I know of.  I ran into one of the authors, Marcel &#8211; who I also knew and respected from the Rails world, at C4[2] and he told me about the book.</p>
<p>So if you are in the Washington DC area and interested in learning about iPhone development, we&#8217;ll be having weekly meetings starting at 7pm every Tuesday at:<br />
La Madeleine &#8211; Bethesda, MD<br />
7607 Old Georgetown Rd<br />
Bethesda, MD 20814<br />
(301) 215-9139â€Ž</p>
<p><a href="http://www.luisdelarosa.com/2008/07/08/nscodernight-washington-dc-tonight/">More detailed driving / parking directions to La Madeleine &#8211; Bethesda, MD</a></p>
<p>See you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2008/10/07/nscodernightdc-is-going-to-be-studying-iphone-sdk-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Things I Learned from C4[2]</title>
		<link>http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/</link>
		<comments>http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 20:39:39 +0000</pubDate>
		<dc:creator>luis</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/</guid>
		<description><![CDATA[I went to C4[2] last month. For the uninitiated, C4[2] is the third (yes we count from zero) conference of its kind, a conference for independent-minded Mac and now iPhone developers, held annually in Chicago, Illinois. It is run by &#8230; <a href="http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I went to C4[2] last month.  For the uninitiated, C4[2] is the third (yes we count from zero) conference of its kind, a conference for independent-minded Mac and now iPhone developers, held annually in Chicago, Illinois.  It is run by <a href="http://rentzsch.com/">Jonathan &#8220;Wolf&#8221; Rentzsch</a>, who is an independent Mac / WebObjects consultant.</p>
<p>It was a great gathering and I look forward to going to C4[3] if I have the opportunity.  So I thought I&#8217;d share my top 10 things that I learned at the conference:</p>
<p>1. Getting like-minded developers together at one place generates a lot of energy, enthusiasm and knowledge sharing.</p>
<p>I think it&#8217;d be great if we could replicate what has been happening in the Ruby community and start to have Regional Objective-C conferences.  This has started to happen with the iPhone Dev Camps already, but it&#8217;d be great to have combined Mac / iPhone Regional conferences, so devs that can&#8217;t afford to travel to Chicago and San Francisco can still get involved and interact with each other in Washington D.C., New York, Seattle, Denver, and wherever else we all are.</p>
<p>2. iPhone development has really come into its own, but its knowledge continues to be restrained by the NDA.</p>
<p>We started off with a presentation by <a href="http://furbo.org/">Craig Hockenberry</a> of how iPhone has changed the way humans interact with computers in much the same way the mouse did.  We ended with a programming contest called Iron Coder (a play off of Iron Chef) which traditionally has been with Mac OS X APIs but this time was on iPhone with an iPhone API.  I finally participated (after helping with past Iron Coders by providing licenses of <a href="http://www.happyapps.com/webnotehappy/">WebnoteHappy</a> as prizes), collaborating with <a href="http://www.joepezzillo.com/">Joe Pezzillo</a> to produce CoreParanoia and also contributed a tiny bit to <a href="http://greenmango.org/">Jose Vazquez</a>&#8216;s 2nd place Tipster.</p>
<p>The rest of the presentations were not iPhone focused, but there were mentions of it throughout.  And it seemed like having an iPhone was part of the requirements for attendance.  I personally got a live demo from <a href="http://blog.neontology.com/">Tim Burks</a> of his iPhone app <a href="http://tootsweet.com/masyu">Masyu</a> which is a pretty fun puzzle game.</p>
<p>The problem however was that the NDA on iPhone development stifled a lot of the conversation.  This generated a lot of complaints and even a t-shirt that rebelled against it.</p>
<p>3. Security is scary, but not as scary as not succeeding.</p>
<p>There was a wild presentation on security that said: don&#8217;t pretend to be a security expert.  Stick to using the Keychain or bcrypt for passwords, use openssl or gpg.  Don&#8217;t use installers or open up listeners on ports.  Don&#8217;t write directly into the DOM.  But all of that doesn&#8217;t matter if your business doesn&#8217;t succeed if you don&#8217;t have a nice looking application and it is unstable or slow.  Also, filter user-supplied content and write a fuzzer for the content you accept.  Make sure you have a security contact, use a crash reporter, and use auto-update securely.  Finally, turn off Java in your web browser to prevent against some of the newer, crazier attacks like GIFAR.</p>
<p>4. Mac users really care about user experience (as if you already didn&#8217;t know that.)</p>
<p>To reiterate what we all sort of know but sometimes overlook since we are so deep in our code, <a href="http://www.atomicwang.org/motherfucker/Index/Index.html">Mike Lee</a> presented &#8220;Pimp My App.&#8221;  The basics: Use real artists, don&#8217;t skimp on your art budget, watch real users use your app, solve a specific problem, and cut as many features as you can.</p>
<p>He also offered some iPhone specific UI tips: start as fast you can, the start-up screen should not be used as a splash screen but more like the real app, restore the state of your app instead of just restarting, don&#8217;t block the UI, and think about the user&#8217;s first experience carefully.</p>
<p>5. Contractors / consultants are Indies too.</p>
<p>I&#8217;ve made applications and I&#8217;ve done consulting.  Both qualify you to be an Indie, meaning independent from another company.  There was a presentation by <a href="http://www.losingfight.com/blog/">Andy Finnell</a> on this and it mostly reiterated what I knew but it was nice to hear it from someone else.  Basically: make sure you have good contracts, these will help you get paid properly and avoid constraints your future development.  I&#8217;d add to this that if you can be choosy, it is good to figure out what kind of clients you want to work for and what kind of projects you want to work on and then only choose those to work on, even if it means taking some time off between projects.</p>
<p>6. Pricing sends a message</p>
<p><a href="http://www.glorifiedtypist.com/">Rich Siegel</a> of Bare Bones gave a presentation on lessons learned over his career.  One of the key ones is that pricing: is a marketing message and shows how you feel about your product.  It also needs to consider how much your overall costs are.  It also positions you among competitors.  That being said, your product / service definitely needs to be differentiated to justify a premium.</p>
<p>7. Warnings should be fixed</p>
<p>This is probably also a no-brainer but I&#8217;ve been at a few companies / projects where warnings are tolerated.  Mentioned by both Rich and Mike, warnings can be the cause of run-time errors down the road.  Its best to generate the most warnings possible and fix them as they come up.  You may find it also advantageous to treat warnings as errors, but either way way, fix them.</p>
<p>8. Mac programmers really care about fonts</p>
<p>Minor but revealing tidbit: the fonts at C4 are carefully chosen.  Compared to other conferences I have been to, I think this shows that Mac programmers care about design more than other programmers.</p>
<p>9. Twitter is the preferred method of communication in the Mac / iPhone developer community</p>
<p>When I wanted to see what was going on and what people were thinking, I checked <a href="http://twitter.com/home">Twitter</a>.  At other conferences, sometimes we would have IRC back-channels.  Using twitter makes the back-channels more open.  Also, we voted for Iron Coder via Twitter.</p>
<p>10. Do the simplest thing possible</p>
<p>Mentioned by Craig, <a href="http://log.scifihifi.com/">Buzz Andersen</a>, and Mike, doing the simplest thing possible, getting feedback and then iterating on that is a good technique when developing products.  I knew this before, but many of us are perfectionists and so we have to keep reminding ourselves of this in order to combat the tendency to either add more features or to keep trying to perfect a certain specific part of our app.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luisdelarosa.com/2008/09/26/10-things-i-learned-from-c42/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 1/46 queries in 0.015 seconds using memcached
Object Caching 608/714 objects using memcached

Served from: www.luisdelarosa.com @ 2012-02-09 07:23:56 -->
