<?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>Mobile Perspectives &#187; iPhone SDK</title>
	<atom:link href="http://www.BluMtnWerx.com/blog/tag/iphone-sdk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.BluMtnWerx.com/blog</link>
	<description>Computing at the Edge!</description>
	<lastBuildDate>Fri, 19 Aug 2011 00:29:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>iPhone Dev &#8211; The Competition</title>
		<link>http://www.BluMtnWerx.com/blog/2009/10/iphone-dev-the-competition/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/10/iphone-dev-the-competition/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 08:07:28 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[iPhone App Marketing]]></category>
		<category><![CDATA[iPhone Dev Books]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=578</guid>
		<description><![CDATA[The professional software engineers out there that have been wondering about developing iPhone Apps might want to consider the competitive environment.]]></description>
			<content:encoded><![CDATA[<p>There are plenty of strong developers out there toiling away at iPhone apps.&nbsp;  Sadly, I feel compelled to remind them, and anyone aspiring to join them, that they are competing for attention with (as of today) something on the order of <a href="http://148apps.biz/app-store-metrics/" title="148Apps.biz: App Store Metrics">100K applications</a>.&nbsp;  Further, more are coming every day from folks like the individual that posed this <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/32268-what-string.html" title="What is a string?" target="_blank">question</a> on the <a href="http://www.iphonedevsdk.com/forum/" title="iPhoneDevSDK Forum" target="_blank">iPhoneDevSDK forum</a> recently:</p>
<blockquote><p><em><strong><span style="color:#0505D0">What is a string?</span></strong></em></p>
<hr .../>
<em><span style="color:#0505D0">I am very new to the iPhone SDK. And I hear the word strings alot, but I have no idea what they are. Could some one explain to me what strings are?</span></em><br />
<em><span style="color:#0505D0">Thanks!</span></em></p></blockquote>
<p>Do we see another flashlight app on the horizon?&nbsp;  The best part is that some helpful members actually made an effort to answer the question.&nbsp;  Amazing.</p>
<p>I guess that you have to start somewhere, but&hellip;</p>
<p>&nbsp;  </p>
<hr .../>
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/10/iphone-dev-the-competition/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone &#8211; All About the Cool</title>
		<link>http://www.BluMtnWerx.com/blog/2009/10/iphone-all-about-the-cool/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/10/iphone-all-about-the-cool/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 00:21:03 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Observations]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[App Marketing]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[iPhone App Marketing]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Motorola Droid]]></category>
		<category><![CDATA[Storm2]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=569</guid>
		<description><![CDATA[According to a recent survey by Retrevo, iPhone owners assess themselves as more "cool" than do Blackberry owners.&#160;  Rating categories included these seemingly shallow criteria:&#160;  Extrovert, Jock, Intellectual and Media Buff.&#160;  iPhone owners ranked themselves as higher across the board.&#160;  After dealing with the "community" for most of this year, I'm sure that they think that.]]></description>
			<content:encoded><![CDATA[<p>As a wave of potentially interesting terminal devices for ultra-mobile computing starts to appear (<a href="http://www.boygeniusreport.com/2009/10/19/motorola-droid-hands-on/" title="BGR:  Motorola Droid hands on!" target="_blank">Moto Droid</a>, <a href="http://www.boygeniusreport.com/2009/10/26/verizon-announces-the-storm2-available-wednesday-for-179-99/" title="BGR:  Verizon announces the BlackBerry Storm2" target="_blank">BlackBerry Storm2</a>, etc.), we&#8217;ve been thinking a lot about our platform choices.&nbsp;  Clearly, the iPhone rules for the entertainment focused elite (or at least those that think of themselves as such).&nbsp;  What has been less clear, however, is how the iPhone, with its carefully managed SDK and App Store, will perform as a mainstream business platform.</p>
<p>As we&#8217;ve been pondering these imponderables, this &#8220;<a href="http://www.retrevo.com/content/blog/2009/10/iPhone-vs-BlackBerry-owners" title="Retrevo Blog:  iPhone vs. BlackBerry Owners: Your Phone Tells All" target="_blank">report</a>&#8221; from <a href="http://www.retrevo.com/" title="Retrevo homepage" target="_blank">Retrevo</a> caught my attention.&nbsp;  From a business manager&#8217;s perspective, the money quote is:</p>
<blockquote><p><em><span style="color:#0505D0">&hellip; they </span></em>[iPhone owners] <em><span style="color:#0505D0">use their smart phones more for activities like watching videos, checking sports scores, and texting and they even watch more adult material on their iPhones than BlackBerry owners.</span></em></p></blockquote>
<p>That certainly sounds productive!&nbsp;  (I&#8217;m listening to Mötley Crüe on my iPod Touch as I write this.)</p>
<p>A cynic reading the Retrevo post might jump to the conclusion that iPhone owners are shallow, arrogant narcissists.&nbsp;  In fact, the post concludes with the following:</p>
<blockquote><p><em><span style="color:#0505D0">&hellip; sure paints a picture of a group of smartphone owners that “think different,” and another more down-to-earth, mainstream group of BlackBerry owners.</span></em></p></blockquote>
<p>I was particularly struck by the final chart presented in the post.&nbsp;  Respondents were apparently asked to rank themselves with respect to several &#8220;coolness&#8221; characteristics.&nbsp;  I think that the self assessment is very telling:</p>
<blockquote><p><em><span style="color:#0505D0">&hellip; iPhone owners rated themselves higher as Intellectuals, Extroverts, and Media Buffs than BlackBerry owners</span></em></p></blockquote>
<p><center><a href="http://www.retrevo.com/content/blog/2009/10/iPhone-vs-BlackBerry-owners" title="Chart:  How iPhone Owners See Themselves" target="_blank"><img style="margin: 2.0em; width: 500px;" src="http://www.BluMtnWerx.com/blog/wp-content/gadgetology_102809_chart6.jpg" alt="Chart:  How iPhone Owners See Themselves" title="Retrevo Blog:  iPhone vs. BlackBerry Owners: Your Phone Tells All"/></a><br />
<em>Source:  <a href="http://www.retrevo.com/content/blog/2009/10/iPhone-vs-BlackBerry-owners" title="Retrevo Blog:  iPhone vs. BlackBerry Owners: Your Phone Tells All" target="_blank">Retrevo Blog:  iPhone vs. BlackBerry Owners: Your Phone Tells All</a></em></center></p>
<p>With that in mind, I&#8217;m finally ready to get around to making a point.&nbsp;  The carefully crafted iPhone user experience is unparalleled for media consumption and gaming.&nbsp;  It&#8217;s in a class by itself.&nbsp;  The thing is, though, that Apple puts up a whole fortress of barriers to developers that want to build real solutions to business problems and make their software available on a range of mobile terminals.&nbsp;  Sure, you can hammer on your app to fit it into the Apple template (and you might even be able to get it approved), but why bother when you have so many more degrees of freedom and device choices with Android / Linux (unfortunately, I don’t know as much about developing for BlackBerry OS 5.0).&nbsp;  Until recently, the answer boiled down to 40M+ iPhones / iPod Touches, against pretty weak alternative hardware.&nbsp;  Perhaps this is starting to change.</p>
<p>&nbsp;  </p>
<hr .../>
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/Moto+Droid" rel="tag">Moto Droid</a>,<a href="http://technorati.com/tag/Android" rel="tag">Android</a>, <a href="http://technorati.com/tag/BlackBerry" rel="tag">BlackBerry</a>, <a href="http://technorati.com/tag/Storm2" rel="tag">Storm2</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/10/iphone-all-about-the-cool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Fonts are on my iPhone?</title>
		<link>http://www.BluMtnWerx.com/blog/2009/08/what-fonts-are-on-my-iphone/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/08/what-fonts-are-on-my-iphone/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 07:38:43 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=258</guid>
		<description><![CDATA[This is really easy to answer, but I keep seeing the question on various forums.&#160;  I've needed to refer to the list several times recently for some UI work, and I got tired of searching for the list every time that I needed it, so...]]></description>
			<content:encoded><![CDATA[<p>The iPhone / iPod touch have a reasonable list of available fonts.&nbsp;  Of course, the selection is limited when compared to a desktop OS, but you should be able to find something suitable for most purposes.&nbsp;  One issue that seems to be a challenge for some developers is the fact that you need the specific font names to use with calls like:</p>
<hr SIZE=5/>
<pre>

<span STYLE="font-family:Courier;"> [myLbl setFont:[UIFont fontWithName:@"Helvetica-BoldOblique" size:20]];</span></pre>
<p align="center"><em>and</em></p>
<p><span STYLE="font-family:Courier;">UIFont *font = [UIFont fontWithName:@"Zapfino" size:titleSz];</span></p>
<hr SIZE=5/>
&nbsp;<br />
The complete list of font names can be easily generated with the following code snippet:</p>
<hr SIZE=5/>
<pre>

<span STYLE="font-family:Courier;">   NSArray *names = [UIFont familyNames];
   NSArray *fontFaces;
   NSLog(@"FONT NAMES");
   for (NSString *name in names)
   {
      NSLog(@"Font Family:  %@",name);
      fontFaces = [UIFont fontNamesForFamilyName:name];
      for (NSString *fname in fontFaces)
      {
         NSLog(@"              %@",fname);
      }
   }

</span></pre>
<hr SIZE=5/>
&nbsp;<br />
That&#8217;s pretty much all that there is to it.&nbsp;  I always worry about maintaining a static list &mdash; What if Apple adds new fonts in 3.x?&nbsp;  With that caveat, here&#8217;s what we get from an iPod touch, running the 2.2.1 version of the software <em>(I removed all of the NSLog information)</em>:</p>
<hr SIZE=10/>
<pre>

<span STYLE="font-family:Courier;">FONT NAMES
  Font Family:  Courier
                Courier
                Courier-BoldOblique
                Courier-Oblique
                Courier-Bold
  Font Family:  AppleGothic
                AppleGothic
  Font Family:  Arial
                ArialMT
                Arial-BoldMT
                Arial-BoldItalicMT
                Arial-ItalicMT
  Font Family:  STHeiti TC
                STHeitiTC-Light
                STHeitiTC-Medium
  Font Family:  Hiragino Kaku Gothic ProN
                HiraKakuProN-W6
                HiraKakuProN-W3
  Font Family:  Courier New
                CourierNewPS-BoldMT
                CourierNewPS-ItalicMT
                CourierNewPS-BoldItalicMT
                CourierNewPSMT
  Font Family:  Zapfino
                Zapfino
  Font Family:  Arial Unicode MS
                ArialUnicodeMS
  Font Family:  STHeiti SC
                STHeitiSC-Medium
                STHeitiSC-Light
  Font Family:  American Typewriter
                AmericanTypewriter
                AmericanTypewriter-Bold
  Font Family:  Helvetica
                Helvetica-Oblique
                Helvetica-BoldOblique
                Helvetica
                Helvetica-Bold
  Font Family:  Marker Felt
                MarkerFelt-Thin
  Font Family:  Helvetica Neue
                HelveticaNeue
                HelveticaNeue-Bold
  Font Family:  DB LCD Temp
                DBLCDTempBlack
  Font Family:  Verdana
                Verdana-Bold
                Verdana-BoldItalic
                Verdana
                Verdana-Italic
  Font Family:  Times New Roman
                TimesNewRomanPSMT
                TimesNewRomanPS-BoldMT
                TimesNewRomanPS-BoldItalicMT
                TimesNewRomanPS-ItalicMT
  Font Family:  Georgia
                Georgia-Bold
                Georgia
                Georgia-BoldItalic
                Georgia-Italic
  Font Family:  STHeiti J
                STHeitiJ-Medium
                STHeitiJ-Light
  Font Family:  Arial Rounded MT Bold
                ArialRoundedMTBold
  Font Family:  Trebuchet MS
                TrebuchetMS-Italic
                TrebuchetMS
                Trebuchet-BoldItalic
                TrebuchetMS-Bold
  Font Family:  STHeiti K
                STHeitiK-Medium
                STHeitiK-Light</span>
  </pre>
<hr SIZE=10/>
&nbsp;  </p>
<p><strong>Happy Fonting!</strong></p>
<p>&nbsp;  </p>
<hr .../>
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/fonts" rel="tag">fonts</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/08/what-fonts-are-on-my-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Taming SoundEngine Processor Utilization</title>
		<link>http://www.BluMtnWerx.com/blog/2009/07/taming-soundengine-processor-utilization/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/07/taming-soundengine-processor-utilization/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 22:26:22 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[iPunt]]></category>
		<category><![CDATA[OpenAL]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=224</guid>
		<description><![CDATA[Here's a simple modification to SoundEngine that cures performance problems with looping effects having long preambles (or attack buffers.)]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using the SoundEngine example code from Apple for OpenAL sounds on iPhone, I have a tip for you.  I ran into a serious processor utilization problem when using SoundEngine_LoadLoopingEffect() to load a sound effect that had a long preamble and then transitioned into a steady-state loop.  At first glance, this function looks ideal for such a thing because it will allow you to load a sound to be played when the effect starts, then a sound that is looped, then a sound that is played when the effect is stopped.  What I found was that, while the preamble (called the <em>AttackBuffer</em> in SoundEngine) is playing, SoundEngineEffect::PlaybackProc() hogs the processor.  This led to serious frame rate issues in <a title="iPunt iPhone game web page." href="http://www.blumtnwerx.com/iPunt.html" target="_blank" title="iPunt iPhone game web page.">iPunt</a> .</p>
<p>The cause is the following code in SoundEngineEffect::PlaybackProc()</p>
<pre>  if (THIS-&gt;HasAttackBuffer())
  {
    ALint numBuffersProcessed = 0;
    while (numBuffersProcessed &lt; 1)
    {
       alGetSourcei(THIS-&gt;GetEffectID(), AL_BUFFERS_PROCESSED, &amp;numBuffersProcessed);
         AssertNoOALError(&quot;Error getting processed buffer number&quot;, end)
    }</pre>
<p>While the attack buffer is playing, you&#8217;re in a tight polling loop waiting for it to complete.  This is no problem if the preamble is really short, but for OpenGL games, it&#8217;s going to cause problems for any sound longer than a fraction of a frame.</p>
<p>The fix, fortunately, is simple.  Sleep this thread for a few milliseconds each iteration of the polling loop in order to give the rest of your application a chance to run.</p>
<p>The modified code is:</p>
<pre>  if (THIS-&gt;HasAttackBuffer())
  {
    ALint numBuffersProcessed = 0;
    while (numBuffersProcessed &lt; 1)
    {
       alGetSourcei(THIS-&gt;GetEffectID(), AL_BUFFERS_PROCESSED, &amp;numBuffersProcessed);
         AssertNoOALError(&quot;Error getting processed buffer number&quot;, end)
       usleep(5000);  // Sleep for 5 mS each polling loop
    }</pre>
<p>This little change makes all the difference for this bit of code and makes it suitable for long (&gt; 1second) preambles.</p>
<p>I&#8217;ve found SoundEngine to work pretty well, although I have had to make a number of modifications to it for my specific application.  However, I think I&#8217;m at the point where I need to write my own OpenAL sound processing class library.  I&#8217;d be interested to hear from some of you to see what you&#8217;re using for game sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/07/taming-soundengine-processor-utilization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone App Marketing Series: When to End App Support for iPhone OS 2.x?</title>
		<link>http://www.BluMtnWerx.com/blog/2009/06/iphone-app-marketing-series-when-to-end-app-support-for-iphone-os-2x/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/06/iphone-app-marketing-series-when-to-end-app-support-for-iphone-os-2x/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 07:40:21 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[App Marketing]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[iPhone App Marketing]]></category>
		<category><![CDATA[iPhone OS 3.0]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=192</guid>
		<description><![CDATA[With iPhone OS 3.0 in the wild, we've been wondering how long we should continue to maintain compatibility with iPhone OS 2.x.&#160;  For us, it really comes down to a resource issue.&#160;  Fortunately, the latest reports seem to suggest that 3.0 adoption is happening very quickly, so we might not be in both worlds for long.]]></description>
			<content:encoded><![CDATA[<p>Now that the iPhone OS 3.0 software is generally available, many developers are asking the same question.&nbsp;  &#8220;When should we stop testing on, and supporting, iPhone OS 2.x?&#8221;&nbsp;  When planning for the transition, I originally thought that we&#8217;d release updates, tested on 3.0, but built for 2.2.1, until sometime in August.&nbsp;  That would probably cover two updates for our apps (we&#8217;re trying to shorten our cycles, but&hellip;).&nbsp;  This is primarily a resource and productivity issue for us.&nbsp;  We have kept half of our devices at 2.2.1 for testing, and we have maintained one of our development machines configured with the old Xcode and the 2.x versions of the SDK.&nbsp;  We also spend a non-trivial (and not particularly productive) chunk of time testing our apps on both 2.2.1 and 3.0.&nbsp;  It would sure be nice to focus all of our resources and energy on development for a single version of the OS.</p>
<p>My hesitation has been based on the fear of losing potential customers who haven&#8217;t upgraded to the newest version of the OS.&nbsp;  Fortunately, a number of apparently independent sources are suggesting that uptake of the new OS is much faster than I might have expected.&nbsp;  With this latest news, it&#8217;s starting to look like we&#8217;ll cut over completely to 3.0 much sooner than I&#8217;d originally planned.</p>
<p>Here&#8217;s some of what I&#8217;m looking at:</p>
<p>Paul, over at <a href="http://tapbots.com/blog/" title="Tapbots Blog">Tapbots</a> is <a href="http://tapbots.com/blog/news/iphone-os-30-adoption-rate" title="Tapbots Post:  iPhone OS 3.0 Adoption Rate">reporting</a> <em>(dated 2009.06.23)</em> that:</p>
<blockquote><p><em>&#8220;It’s pretty clear that at least our customers are upgrading to 3.0 at an incredibly fast pace.&#8221;</p>
<p>&#8220;<strong>&hellip;</strong> running at an overall 75% upgrade rate which is pretty insane considering the number of devices and the fact that its only been 5 days.&#8221;</p>
<p>&#8220;The iPhone upgrade rate is a bit higher then the overall rate, currently sitting at 79%.&#8221;</p>
<p>&#8220;<strong>&hellip;</strong> the iPod Touch has just passed 50%.&#8221;<br />
</em></p></blockquote>
<p>The post also has some nice graphs of what they&#8217;re seeing.&nbsp;  They promise to update the post as new information comes in.&nbsp;  I&#8217;ll be checking back periodically.</p>
<p>In a similar vein, <a href="http://www.admob.com/" title="AdMob homepage">AdMob</a> just published a <a href="http://metrics.admob.com/2009/06/44-of-iphone-ad-requests-coming-from-the-30-os/" title="AdMob:  44% of iPhone ad requests coming from the 3.0 OS">report</a> <em>(Their graphs are dated 2009.06.20, so this covers just a few days after the iPhone OS 3.0 software was generally available)</em> that also suggests strong, albeit somewhat lower uptake rates for the iPhone:</p>
<blockquote><p><em><strong>&hellip;</strong>44% of iPhone ad requests coming from the 3.0 OS</em></p></blockquote>
<p>AdMob&#8217;s data suggests that just 1% of requests coming from iPod touches are originating with devices  running 3.0.</p>
<p>For as long as they continue to be available, here are the charts from AdMob:<br />
<a href="http://metrics.admob.com/2009/06/44-of-iphone-ad-requests-coming-from-the-30-os/" title="AdMob:  44% of iPhone ad requests coming from the 3.0 OS"><img style="float: center; margin: 1em; width: 408px;" src="http://metrics.admob.com/wp-content/uploads/2009/06/iphone-os-june-22.jpg" alt="AdMob:  44% of iPhone ad requests coming from the 3.0 OS"/></a><br />
and<br />
<a href="http://metrics.admob.com/2009/06/44-of-iphone-ad-requests-coming-from-the-30-os/" title="AdMob:  44% of iPhone ad requests coming from the 3.0 OS"><img style="float: center; margin: 1em; width: 408px;" src="http://metrics.admob.com/wp-content/uploads/2009/06/touch-os-june-221.jpg" alt="AdMob:  44% of iPhone ad requests coming from the 3.0 OS"/></a><br />
Of course, it&#8217;s always possible that we&#8217;re seeing sample bias in these two reports.&nbsp;  Perhaps customers of Tapbots and users of apps that present AdMob ads are not representative of the total population.&nbsp;  However, I&#8217;m inclined to believe the trend, if not the specific figures.&nbsp;  The 3.0 upgrades are too compelling (and free for iPhone users) to ignore.&nbsp;  I predict that we&#8217;ll see 80% adoption across the board by the end of July.</p>
<p>It will be fascinating to see how these numbers change over the next couple of weeks, but I&#8217;m now thinking that we&#8217;ll jump to 3.0 even sooner than I&#8217;d planned.&nbsp;  These trends suggest that we&#8217;ll be able to continue to address the mainstream iPhone market, while allowing our development team to be more focused on building good new stuff, rather than testing on permutations of OS versions.</p>
<p>What kind of conclusions are you reaching about this?&nbsp;  Please let us know.</p>
<p>&nbsp;<br />
&#8212;&#8212;&#8211;<br />
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a>, <a href="http://technorati.com/tag/iPhone+OS+3.0" rel="tag">iPhone OS 3.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/06/iphone-app-marketing-series-when-to-end-app-support-for-iphone-os-2x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taming Touch / Multi-Touch on the iPhone</title>
		<link>http://www.BluMtnWerx.com/blog/2009/06/taming-touch-multi-touch-on-the-iphone/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/06/taming-touch-multi-touch-on-the-iphone/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 06:14:25 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[multi-touch]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=178</guid>
		<description><![CDATA[It seemed so simple at the time.&#160;  I wanted to manifest a different behavior when dragging the player sprite in iPuck with two fingers, instead of just one finger.&#160;  Not so fast, Skippy.&#160;  The solution is buried in the documentation, but most of the touch code samples that I've seen don't implement it.]]></description>
			<content:encoded><![CDATA[<p>Gameplay in <a href="http://www.blumtnwerx.com/iPuck.html" title="iPuck Product Page">iPuck</a> <em><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=314153461&#038;mt=8" title="iPuck on the App Store">(App Store)</a></em>  is straightforward.&nbsp;  The player manipulates his/her sprite to knock the puck into the opponent’s goal, while guarding their own goal.&nbsp;  When I transitioned to <a href="http://wiki.slembcke.net/main/published/Chipmunk" title="Chipmunk 2D Physics Main Page">Chipmunk</a> for the 2D physics modeling, I had an opportunity to manifest two different behaviors as the player sprite is dragged.&nbsp;  &#8220;Great,&#8221; I thought, &#8220;I&#8217;ll have it behave one way when the player is dragging with one finger, and the other way when dragging with two fingers.&#8221;&nbsp;  Sounds good, right?</p>
<p>Unfortunately, it didn&#8217;t work.&nbsp;  I ended up writing a bunch of needlessly complex code that sort of emulated the behavior that I wanted.&nbsp;  I almost decided to abandon the functionality because I couldn&#8217;t get it to work reliably in all situations.&nbsp;  I knew that there had to be a better way to solve this problem.</p>
<p>Some of the challenges include:</p>
<ul>
<li>First, <span STYLE="font-family:Courier;">touchesBegan:withEvent:</span> gets called every time a finger touches the screen.&nbsp;  Thus, if the second finger touches just a tiny bit later than the first, <span STYLE="font-family:Courier;">touchesBegan:withEvent:</span> actually gets called with two separate single <span STYLE="font-family:Courier;">touchesBegan</span> events.&nbsp;  It&#8217;s easy enough to have a test to see whether the app is already processing a touch, but there are potential reliability issues with this because I have to guarantee that the touch state will always be cleaned up, or I might not be able recognize a legitimate <span STYLE="font-family:Courier;">touchesBegan:withEvent:</span> call.<br />
&nbsp;  </li>
<li>Second, when the set of touches is presented to <span STYLE="font-family:Courier;">touchesMoved:withEvent:</span>, a given set may contain a touch point from either finger, or both fingers.&nbsp;  If I get touches for both fingers, the order is predictable (first finger&#8217;s touch in element 0, second finger&#8217;s touch in element 1), within the scope of a single touch sequence (<em>down, move, up</em>).&nbsp;  However, if I only get one touch point, it could be from either finger, so I thought that my code had to try to sort out whether it could process the point, or not, by filtering for an &#8220;acceptable&#8221; delta (<em>I saw this technique in some sample code</em>).&nbsp;  I could use a heuristic technique to do this, but it&#8217;s really just a best guess.&nbsp;  Of course, this filtering can make for confusing gameplay, because the user thinks that they&#8217;re moving their the puck sprite, but if the &#8220;master&#8221; finger isn&#8217;t moving as fast as the &#8220;secondary&#8221; finger, the sprite may not behave as they are expecting.<br />
&nbsp;  </li>
<li>Finally, each time the player lifts either, or both, finger(s), <span STYLE="font-family:Courier;">touchesEnded:withEvent:</span> gets called, and I had to figure out which finger had actually lifted so that I could take the appropriate action.</li>
</ul>
<p>After stewing about the problem overnight, I dug into Apple&#8217;s documentation and found the answer.&nbsp;  Unfortunately, the code samples that I referenced when I wrote iPuck completely ignore this method.&nbsp;  In the discussion below, I&#8217;m focusing on two fingered multi-touches, because that&#8217;s the simplest scenario.&nbsp;  Everything that I say, however, extends completely to <em>n</em> finger touches.</p>
<p>Most of the sample code running around  handled single touches in a fashion something like this:</p>
<p><strong>NOTE:</strong>  <em>THIS ONLY WORKS RELIABLY IF YOUR VIEW DOES NOT HAVE MULTITOUCH ENABLED</em></p>
<p><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {<br />
&nbsp;  &nbsp;  // get the first touch<br />
&nbsp;  &nbsp;  UITouch *touch = [touches anyObject];<br />
&nbsp;  &nbsp;  if ([touch view] == myView) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  CGPoint touchPt = [[touches anyObject] locationInView:myView];<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // do something with the point </span> &hellip; <span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
&nbsp;  &nbsp;  }<br />
}</span><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesMoved: (NSSet*)touches withEvent: (UIEvent*)event {<br />
&nbsp;  &nbsp;  // drag the sprite object along.<br />
&nbsp;  &nbsp;  CGPoint pt = [[touches anyObject] locationInView:myView];<br />
&nbsp;  &nbsp;  // do something with the new pt.<br />
}</span></p>
<p><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {<br />
&nbsp;  &nbsp;  // If the touch was in myView, handle it.<br />
&nbsp;  &nbsp;  UITouch *touch = [touches anyObject];<br />
&nbsp;  &nbsp;  if ([touch view] == myView) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // clean up<br />
&nbsp;  &nbsp;  }<br />
}</span></p>
<p><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {<br />
&nbsp;  &nbsp;  // If the touch was in the myView, handle it.<br />
&nbsp;  &nbsp;  UITouch *touch = [touches anyObject];<br />
&nbsp;  &nbsp;  if ([touch view] == myView) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // clean up<br />
&nbsp;  &nbsp;  }<br />
}</span></p>
<p>My first effort, as described above, was to simply convert the set of <span STYLE="font-family:Courier;">touches</span> into an array and try to figure out what I was getting.</p>
<p><strong>&hellip;</strong><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
&nbsp;  &nbsp;  NSArray *touchArr = [touches allObjects];<br />
&nbsp;  &nbsp;  NSInteger touchCnt = [touchArr count];<br />
&nbsp;  &nbsp;  UITouch *newTouch;<br />
&nbsp;  &nbsp;  CGPoint pt;<br />
&nbsp;  &nbsp;  if (touchCnt >= 1) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  newTouch = [touchArr objectAtIndex:0];<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  pt1 = [newTouch locationInView:myView];<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // do something with pt1<br />
&nbsp;  &nbsp;  }</span><br />
<strong>&hellip;</strong></p>
<p>Sadly, this didn&#8217;t work very well, so I went to Apple&#8217;s excellent documentation.&nbsp;  The answer to my problem is right there, in the <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITouch_Class/Reference/Reference.html#//apple_ref/occ/cl/UITouch" title="UITouch Class Reference manual">UITouch Class Reference</a> document:</p>
<blockquote><p><em>A <span STYLE="font-family:Courier;">UITouch</span> object is persistent throughout a multi-touch sequence.</em></p></blockquote>
<p><strong>That&#8217;s it!</strong></p>
<p>I quickly changed my code to keep track of the specific <span STYLE="font-family:Courier;">UITouch</span> objects.&nbsp;  We can organize these touch objects in a number of ways, including static module variables, an array of <span STYLE="font-family:Courier;">UITouch*</span>&#8216;s or an <span STYLE="font-family:Courier;"><a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html" title="NSMutableDictionary Class Reference">NSMutableDictionary</a></span> (<em>indexed by the touch objects&#8217; IDs</em>), depending on the specific requirement of the situation.</p>
<p>This allows me to do things like</p>
<p><strong>&hellip;</strong><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small">static UITouch *g_firstTouch = nil;</span><br />
<strong>&hellip;</strong><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {<br />
&nbsp;  &nbsp;  // get the first touch<br />
&nbsp;  &nbsp;  NSArray *touchArr = [touches allObjects];<br />
&nbsp;  &nbsp;  NSInteger touchCnt = [touchArr count];<br />
&nbsp;  &nbsp;  UITouch *aTouch = [touchArr objectAtIndex:0];</span><br />
<strong>&hellip;</strong><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small">&nbsp;  &nbsp;  &nbsp;  &nbsp;  if (([aTouch view] == myView) &#038;&#038; (g_firstTouch == nil)) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  // keep track of the first touch object in the view.<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  // this touch will represent this finger for the duration<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  // of the sequence<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  g_firstTouch = aTouch;<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  // more stuff.</span><br />
<strong>&hellip;</strong> <em>code to loop through the touchArr doing other processing not shown</em> <strong>&hellip;</strong><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesMoved: (NSSet*)touches withEvent: (UIEvent*)event {</span><br />
<strong>&hellip;</strong> <em>looping code not shown</em> <strong>&hellip;</strong><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  if (aTouch == g_firstTouch) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  //do something apppropriate</span><br />
&hellip;<strong>or</strong>&hellip;<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
&nbsp;  &nbsp;  if (firstTouchNotInSet) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // the touchesMoved method was called, but our first touch<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // wasn&#8217;t in the set, use its current data<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  CGPoint pt1 = [g_firstTouch locationInView:myView];<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  // do something with pt1</span><br />
<strong>&hellip;</strong><br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {</span><br />
<strong>&hellip;</strong> <em>looping code not shown</em> <strong>&hellip;</strong><span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small"><br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  if (aTouch == g_firstTouch) {<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  // the first touch is over, do something appropriate.</span><br />
<strong>&hellip;</strong></p>
<p>&nbsp;<br />
<strong>Notes:</strong></p>
<ul>
<li>I extracted this code from our apps, and tried to make it generic to illustrate the points.&nbsp;  I didn&#8217;t recompile/retest the extracted code, so I may have botched the process a little bit &#8211; apologies in advance</li>
<li>Don&#8217;t forget that you have to enable multi-touch, it&#8217;s disabled by default.&nbsp;  You&#8217;ll need to set the multipleTouchEnabled property:&nbsp;  <span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small">[myView  setMultipleTouchEnabled:Yes];</span></li>
<li>The <span STYLE="font-family:Courier;">timestamp</span> property of <span STYLE="font-family:Courier;">UIEvent</span> can provide another way to organize your app&#8217;s events</li>
<li>For sprite movement, I typically have to apply deltas to the previous sprite location, I&#8217;ve always kept track of the previous touch point within my touchesMoved:withEvent method.&nbsp;  It turns out that this isn&#8217;t strictly necessary, as <span STYLE="font-family:Courier;">UITouch</span> has the<br />
<span STYLE="font-family:Courier;background-color:#CCFFFF;font-size:x-small">- (CGPoint)previousLocationInView:(UIView *)view</span><br />
method, which provides the exact same functionality &#8211; I haven&#8217;t verified the performance impact, but it could simplify your code.</li>
<li>After all of this, I decided that I didn&#8217;t like two-finger dragging for controlling the player sprite.  Multi-touch is great for swipes and gestures, but it doesn&#8217;t seem to lend itself to the quick movements and rapid direction changes needed to play the game, so I came up with a completely different interface implementation for v1.1 of iPuck.
</li>
</ul>
<p>&nbsp;<br />
<strong>Bottom Line:</strong></p>
<p>We can take advantage of the fact that each specific <span STYLE="font-family:Courier;">UITouch</span> object spans the duration of a down / drag / up operation to unambiguously identify each touch and track it from <span STYLE="font-family:Courier;">touchesBegan:</span> through <span STYLE="font-family:Courier;">touchesMoved:</span> and take appropriate action at <span STYLE="font-family:Courier;">touchesEnded:</span>.&nbsp;  This allows us to reliably track the movement of each individual finger through the touch sequence and to respond appropriately to calls when not all of the fingers are represented in the touch set.</p>
<p>&nbsp;<br />
&#8212;&#8212;&#8211;<br />
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a>, <a href="http://technorati.com/tag/multi-touch" rel="tag">multi-touch</a>, <a href="http://technorati.com/tag/iPuck" rel="tag">iPuck</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/06/taming-touch-multi-touch-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cross SDK Code Hygiene in Xcode</title>
		<link>http://www.BluMtnWerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 22:25:31 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[iPhone Dev Tools]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=153</guid>
		<description><![CDATA[With the upcoming 3.0 Version of iPhone OS, several methods have been deprecated.&#160;  We'll cover a technique for ensuring that you get clean compiles with both 2.x.y and 3.0.]]></description>
			<content:encoded><![CDATA[<p>I am a big believer in clean compiles.&nbsp;  Unless it&#8217;s absolutely impossible, which is rare, I want my code to compile with no warnings.&nbsp;  This is partly just discipline, but it&#8217;s also because I&#8217;ve run into cases where I missed real problems because I didn&#8217;t notice the issue amongst the compiler warnings that I was ignoring.</p>
<p>With 3.0, several methods that were used in 2.x.y are now deprecated.&nbsp;  Use of these methods will generate warnings in 3.0.&nbsp;  Unfortunately, the correct code for 3.0 won&#8217;t work in 2.2.1, for example:</p>
<p><strong>Perfectly good 2.2.1 code:</strong></p>
<p><span STYLE="font-family:Courier;">&nbsp;  &nbsp;  [startButton setFont:playFont];</span></p>
<p><strong>Clean compiling 3.0 code:</strong></p>
<p><span STYLE="font-family:Courier;">&nbsp;  &nbsp;  [[startButton titleLabel] setFont:playFont];</span></p>
<p>So we&#8217;re faced with a problem.&nbsp;  How do we write code that compiles cleanly in 3.0, while maintaining our ability to do clean 2.2.1 (I&#8217;m tired of the 2.x.y notation &#8211; just assume that I&#8217;m talking generically about version 2 of the SDK) builds?</p>
<p>When we first encountered this, I found several suggestions, most of which were wrong to one degree or another.&nbsp;  As nearly as I can tell, the method that I&#8217;m suggesting is more generally workable.</p>
<p>Restating the problem, we need to write our code so that it compiles cleanly, and works, with both a strictly 2.2.1 version of the SDK and with a 3.0 version.&nbsp;  We get extra bonus points if the code won&#8217;t need to be revised when the successor to 3.0 comes out.</p>
<p>Because of the requirement to continue to work with strict 2.2.1, we can&#8217;t rely on the preprocessor constant for 3.0 being defined.&nbsp;  There&#8217;s also an interesting issue between the simulator and the device that I&#8217;ll cover later.</p>
<p>Anyway, here&#8217;s what we came up with:</p>
<p><span STYLE="font-family:Courier;">#ifndef __IPHONE_3_0<br />
#define __IPHONE_3_0 30000<br />
#endif<br />
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0<br />
&nbsp;  &nbsp;  [[startButton titleLabel] setFont:playFont];<br />
#else<br />
&nbsp;  &nbsp;  [startButton setFont:playFont];<br />
#endif</span></p>
<p>When I&#8217;m building against the 3.0 SDK, <span STYLE="font-family:Courier;">__IPHONE_3_0</span> is defined by Xcode, so my directives don&#8217;t interfere.&nbsp;  If all you wanted was the answer, you can stop here.&nbsp;  If you&#8217;d like more background on this issue, please continue reading.</p>
<p>First, a bit about where the pertinent preprocessor #defines are specified.&nbsp;  The file is <span STYLE="font-family:Courier;">Availability.h</span></p>
<p>For the simulator, the full pathname to Availability.h is:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">/Developer/Platforms/iphoneSimulator.platform/Developer/SDKs/</span>&nbsp;  <strong>&crarr;</strong><br />
&nbsp;  &nbsp;  &nbsp;  &hellip; &nbsp;  <span STYLE="font-family:Courier;">iPhoneSimulator2.2.1.sdk/usr/include/Availability.h</span></p>
<p>For the device the path is:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">/Developer/Platforms/iphoneOS.platform/Developer/SDKs/</span>&nbsp;  <strong>&crarr;</strong><br />
&nbsp;  &nbsp;  &nbsp;  &hellip; &nbsp;  <span STYLE="font-family:Courier;">iPhoneOS2.2.1.sdk/usr/include/Availability.h</span></p>
<p>In the version of Availability.h that goes along with 2.2.1, the following are defined:</p>
<p><span STYLE="font-family:Courier;">#define __IPHONE_2_0     20000<br />
#define __IPHONE_2_1     20100<br />
#define __IPHONE_2_2     20200</span></p>
<p>Note that there is no <span STYLE="font-family:Courier;">__IPHONE_2_2_1</span></p>
<p>Now, here&#8217;s the tricky bit.&nbsp;  With Xcode, the mechanisms for communicating the version of the SDK that you&#8217;re using differ between builds for the simulator and builds for the device.&nbsp;  When compiling for the simulator, Xcode&#8217;s default configuration for a 2.2.1 build sets a flag as follows:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">-D__IPHONE_OS_VERSION_MIN_REQUIRED=20000</span></p>
<p>If you&#8217;re paying attention, you&#8217;ll notice that, when building for the simulator, targeting the 2.2.1 SDK, Xcode is setting the flag to 20000.</p>
<p>When building for the device, on the other hand, Xcode uses a completely different technique.&nbsp;  Instead of defining a version value for the preprocessor, the preprocessor substitutes:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__</span></p>
<p>in place of:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">__IPHONE_OS_VERSION_MIN_REQUIRED</span>.</p>
<p>Xcode (according to the comments in AvailabilityInternal.h) then has the compiler set:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__</span></p>
<p>by using <span STYLE="font-family:Courier;">-miphoneos-version-min</span>.&nbsp;  The actual compile directive when building for the 2.2.1 SDK is:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">-miphoneos-version-min=2.2.1</span></p>
<p>The implication of this is that, when you build for the simulator, the following code:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;">NSLog(@&quot;MIN VERS REQD:  %d &#45;&#45; Current Version:  %d&quot;,</span>&nbsp;  <strong>&crarr;</strong><br />
&nbsp;  &nbsp;  &nbsp;  &hellip; &nbsp;  <span STYLE="font-family:Courier;">__IPHONE_OS_VERSION_MIN_REQUIRED,__IPHONE_2_2);</span></p>
<p>Causes this string to be output to the console:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;"><strong>MIN VERS REQD:  20000 &#45;&#45; Current Version:  20200</strong></span></p>
<p>The exact same code, running on the actual device, produces:</p>
<p>&nbsp;  &nbsp;  <span STYLE="font-family:Courier;"><strong>MIN VERS REQD:  20201 &#45;&#45; Current Version:  20200</strong></span></p>
<p>The reason I shared this in painful detail is to explain why some of the solutions that people are suggesting for this issue might not work in the general case.</p>
<p>Assuming that we&#8217;re building for the simulator as many of us do during development, the default Xcode configuration won&#8217;t let us find out whether we&#8217;re using any SDK later than 2.0.&nbsp;  For example, if we have code that goes something like:</p>
<p><span STYLE="font-family:Courier;">// DO NOT DO THIS<br />
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2<br />
&nbsp;  &nbsp;  [[startButton titleLabel] setFont:playFont];<br />
#else<br />
&nbsp;  &nbsp;  [startButton setFont:playFont];<br />
#endif</span></p>
<p>This code will work on the simulator because <span STYLE="font-family:Courier;">__IPHONE_OS_VERSION_MIN_REQUIRED</span> will be 20000, which is not greater than 20200.&nbsp;  It will <strong>not</strong> work on the device, however, because 20201 is greater than 20200.&nbsp;  Remember that there is no official definition of <span STYLE="font-family:Courier;">_IPHONE_2_2_1</span>.&nbsp;  Sigh&#8230;</p>
<p>Another approach that I considered was:</p>
<p><span STYLE="font-family:Courier;">// THIS MIGHT WORK, BUT I DON&#8217;T RECOMMEND IT<br />
#ifndef __IPHONE_3_0<br />
&nbsp;  &nbsp;  NSLog(@&quot;THE 3.0 SDK IS NOT DEFINED&quot;);<br />
#else<br />
&nbsp;  &nbsp;  NSLOG(@&quot;THE 3.0 SDK IS DEFINED&quot;);<br />
#endif</span></p>
<p>The problem here is that I&#8217;m not testing the value, I&#8217;m simply seeing if it&#8217;s defined.&nbsp;  If the variable ever gets defined in my code (perhaps due to a bit like what I&#8217;m proposing) or if the Xcode ever picks up a version of Availability.h that defines <span STYLE="font-family:Courier;">__IPHONE_3_0</span> when you&#8217;re building for 2.2.1 (I know that this shouldn&#8217;t happen, but better safe than sorry) the preproccesor will eliminate the wrong lines of code.&nbsp;  Remember that there are multiple versions of Availability.h kicking around on your system.&nbsp;  Check out the one at <span STYLE="font-family:Courier;">/usr/include/Availability.h</span> sometime.</p>
<p>&nbsp;  </p>
<p>&#8212;&#8212;&#8211;<br />
Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/iPhone+OS" rel="tag">iPhone OS</a>, <a href="http://technorati.com/tag/Xcode" rel="tag">Xcode</a>,<a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>if (palm + sprint == marketingGenius)</title>
		<link>http://www.BluMtnWerx.com/blog/2009/06/if-palm-sprint-marketinggenius/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/06/if-palm-sprint-marketinggenius/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 08:08:33 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Observations]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Palm]]></category>
		<category><![CDATA[Pre]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=149</guid>
		<description><![CDATA[I've been watching the ramp up to the launch of the Palm Pre with great interest, but I'm pretty puzzled by some of the recent developments and disclosures.]]></description>
			<content:encoded><![CDATA[<p>Before I launch into this, I should share some highlights of my long (extremely one-sided) relationship with <a href="http://www.palm.com/us/" title="Palm US homepage">Palm</a>.</p>
<ul>
<li>I&#8217;ve loved the Palm devices since the first moment that I used them.</li>
<li>My teams developed some of the earliest Palm/Mac conduits.</li>
<li>A surprisingly large number of my career decisions and options since then have been a direct result of the people that I met, and the ideas that I was exposed to, in the early days of working with Palm.</li>
<li>I still have one of my Palm Pilots in those special clear bodies hanging around, somewhere.</li>
<li>I flew to New York and bought a Palm Vx because they were out of stock in local stores.&nbsp;  I was actually there for meetings, but that was the quickest way for me to get my greedy hands on one of the finest PDA&#8217;s ever designed.</li>
<li>I still use that Palm Vx, because my life is locked into its To-Do list.</li>
<li>I shouldn&#8217;t admit this, but I&#8217;m faster with Graffiti then I am with the soft keyboard on my iPod touch</li>
</ul>
<p>My point is, that I&#8217;ve always rooted for Palm, even when I haven&#8217;t been able to rationalize buying their increasingly irrelevant devices.&nbsp;  When I started hearing about <a href="http://en.wikipedia.org/wiki/WebOS" title="webOS Wikipedia Page">webOS</a> and the new <a href="http://www.palm.com/us/products/phones/pre/index.html" title="Palm Pre Intro Page">Pre</a>, I was really hopeful that this could be &#8220;the Next One&#8221; from Palm.&nbsp;  I even applied to get access to their <a href="http://developer.palm.com/" title="Palm Developer Page">Software Development Kit</a> <em>(no word back from Palm on our application)</em>.&nbsp;  It seems like they are really building up momentum for their launch this week, but some strange bits have started filtering into the infostream.</p>
<p>For example, clearly they need the Pre to be a big hit coming out of the starting blocks, so you&#8217;d think that all efforts would be focused on getting people to purchase quickly.&nbsp;  Instead of that, the week before the launch, they let word get out that the Pre will be available on the vastly superior Verizon network in roughly six months.&nbsp;  Almost immediately, they&#8217;ve limited their early adopters to current Sprint users.&nbsp;  Why switch to Sprint, now, when you can get the device on <a href="http://www.reuters.com/article/rbssWirelessTelecommunicationServices/idUSN2833749320090528" title="Reuters Report on Other Carriers for Pre">Verizon (or maybe AT&#038;T</a>, if you&#8217;re so inclined) in 6-7 months?&nbsp;  Curious.</p>
<p>There&#8217;s another interesting bit that has some in the developer community scratching our collective heads.&nbsp;  At launch, most third party developers will be limited to <a href="http://www.wired.com/gadgetlab/2009/05/palm-we-can%E2%80%99t-afford-to-sell-the-pre-to-the-wrong-customers/" title="Wired Busts Early Limitations on Third Party Pre Dev">web programming using CSS and javascript</a>.&nbsp;  As I&#8217;ve made quite clear in an <a href="http://www.blumtnwerx.com/blog/2009/05/who-will-be-king-of-the-mobile-os/" title="Mobile Perspectives Post:&nbsp;  Who Will Be King of the Mobile OS?">earlier post</a>, I <strong>firmly</strong> believe that the availability of third party apps and an active developer community will be critical to the success of any modern mobile platform.&nbsp;  Apparently, &#8220;<a href="http://www.boygeniusreport.com/2009/05/29/palm-pre-review/" title="Boy Genius Take on the new Pre">special partners</a>&#8221; have access to the good stuff, but the rest of us riffraff are locked out, at least for the time being.&nbsp;  In light of the explosive success of the App Store, it seems that Apple has set the bar for a third-party app ecosystem pretty high.&nbsp;  It&#8217;s hard to see how the early experience with the Pre will even be close.&nbsp;  I don&#8217;t accept the arguments that reference the early days of the iPhone.&nbsp;  That was then.&nbsp;  What matters, now, is the competitive environment today.</p>
<p>Oh yeah, and then there&#8217;s the bit about syncing with iTunes.&nbsp;  In the absence of their own entertainment source, this seems like critical functionality for the Pre, so imagine my dismay when I read that this may be a <a href="http://www.fastcompany.com/blog/kit-eaton/technomix/palms-pre-syncs-itunes-apple-may-stop-it-pretty-quickly" title="Fast Company:&nbsp;  Palm's Pre Syncs With iTunes, but Apple May Squash the Link ">hack job that Apple will stamp out pretty quickly</a>.&nbsp;  From the outside, it&#8217;s impossible to know what&#8217;s really going on at Palm/Sprint.&nbsp;  This seems like desperate times for both, but stunts like this rarely work out well for anyone except publicity-starved startups.&nbsp;  <em>(Update:  2009.07.15 &#8211; I guess that &#8220;<a href="http://www.pcworld.com/article/168487/itunes_821_revokes_palm_pres_syncing_privileges.html" title="MacWorld:  ITunes 8.2.1 Revokes Palm Pre's Syncing Privileges">all good things must come to an end</a>.&#8221;)</em></p>
<p>I sincerely hope that the Pre is a runaway success for Palm.&nbsp;  I&#8217;d like nothing better than to have a full suite of BluMtnWerx apps running on the Pre and generating boatloads of revenue for us.&nbsp;  When it&#8217;s available on Verizon, I may buy one, but the latest revelations are certainly unsettling.</p>
<p>Let&#8217;s be very clear.&nbsp;  Apple has set the standard.&nbsp;  Palm/Sprint need to field a clearly superior offering.&nbsp;  We’ll see what happens on Saturday…</p>
<p>&nbsp;<br />
&#8212;&#8212;&#8211;</p>
<p>Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a>, <a href="http://technorati.com/tag/Sprint" rel="tag">Sprint</a>, <a href="http://technorati.com/tag/Verizon" rel="tag">Verizon</a>, <a href="http://technorati.com/tag/Palm+Pre" rel="tag">Palm Pre</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/06/if-palm-sprint-marketinggenius/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More Fun With Coordinate Systems</title>
		<link>http://www.BluMtnWerx.com/blog/2009/04/more-fun-with-coordinate-systems/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/04/more-fun-with-coordinate-systems/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 03:18:51 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=59</guid>
		<description><![CDATA[We all know that each UIView has its own origin, thus, internally, its own coordinate space.&#160;  Except, that is, when you ask a view for its center.]]></description>
			<content:encoded><![CDATA[<p>Thus far, in my very brief iPhone SDK programming career, I probably have had more bugs caused by each view having its own coordinate space than any other single issue.&nbsp;  Just when I thought that I had it all figured out, I ran into this issue.</p>
<p>If you ask a UIView for its &#8220;<strong>bounds</strong>,&#8221; you get back a rectangle, with an origin at (0,0) and a size set to the frame size of the view.&nbsp;  That&#8217;s exactly what I would expect.&nbsp;  Now, I know that relative position in a header file means absolutely nothing.&nbsp;  However, the very next property specified in the UIViewGeometry category defined for UIView is &#8220;<strong>center</strong>.&#8221;&nbsp;  Guess which coordinate space &#8220;<strong>center</strong>&#8221; is in.&nbsp;  Unfortunately, I guessed that it would be in the space of the receiver &#8211; <strong><em>WRONG</em></strong>.&nbsp;  It&#8217;s actually in the space of the superview.&nbsp;  I even checked the UIView Class Reference documentation.&nbsp;  Surely enough, &#8220;<em>The center is specified within the coordinate system of its superview.</em>&#8221;</p>
<p>I&#8217;ve been warned, from now on, I&#8217;m always going to refer back to Apple&#8217;s Developer Documentation.</p>
<p>Happy coding&#8230;</p>
<p>Technorati Tags:&nbsp; <a href="http://technorati.com/tag/iPhone" rel="tag">iPhone</a>, <a href="http://technorati.com/tag/iPod+Touch" rel="tag">iPod Touch</a>, <a href="http://technorati.com/tag/Apple" rel="tag">Apple</a>, <a href="http://technorati.com/tag/mobile" rel="tag">mobile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/04/more-fun-with-coordinate-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Musings on the Sometimes Maligned Interface Builder</title>
		<link>http://www.BluMtnWerx.com/blog/2009/03/musings-on-the-sometimes-maligned-interface-builder/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/03/musings-on-the-sometimes-maligned-interface-builder/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 20:18:45 +0000</pubDate>
		<dc:creator>deans</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[IB]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[iPhone Dev Tools]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=55</guid>
		<description><![CDATA[I've seen both positive and negative comments regarding IB.&#160;  Put me squarely in the fan camp.&#160;  While the application has some odd issues, the benefits of being able to do your interface design on screen, using drag &#038; drop, more than compensate for the challenges.&#160;  In fact, there are pretty straightforward ways to overcome many of the limitations.&#160;  We'll talk about one "trick" in this post.]]></description>
			<content:encoded><![CDATA[<p>We all know Interface Builder (IB) as the visual design tool that some of use to lay out UIs for iPhones / iPod Touches.   When I was trying to figure out how to use it, I encountered a great deal of commentary both positive, and negative.   While there will always be those who prefer to do everything programmatically, I&#8217;m one of the lazy ones who appreciates tools that let me accomplish my tasks without writing heaps of potentially buggy code.</p>
<p>IB lets me position my controls interactively, and it provides somewhat straightforward hooks for connecting my program to the new controls.   One of the big complaints that I noticed, and one that frustrated me a bit, at least at first, was that IB doesn&#8217;t provide full access to all of the settings on the controls that it specifies.   The specific example for me was setting the font for the <span style="font-family: Courier;">Title</span> text for the regular &quot;<span style="font-family: Courier;">Round Rect Button</span>.&quot;   Support for this operation is clearly evident via the &quot;<span style="font-family: Courier;">setfont:</span>&quot; method specified in the class header file, but I couldn&#8217;t find any way to get at the method through the IB Attributes Inspector.</p>
<p>As suggested above, I&#8217;m pretty lazy, so I didn&#8217;t want to abandon IB just to change the font face and size, then a solution appeared.   I simply established an outlet to the specific button:</p>
<p><span style="font-family: Courier;">@interface ButtonTestViewController : UIViewController {</span><br />
&#8230;<br />
<span style="font-family: Courier;">IBOutlet UIButton *theButton;</span><br />
&#8230;</p>
<p>and wrote the following code:<br />
&#8230;<br />
<span style="font-family: Courier;">UIFont *theFont = [UIFont boldSystemFontOfSize:30];<br />
[theButton setFont:theFont];<br />
CGSize tOff = CGSizeMake(2.0,2.0);<br />
[theButton setTitleShadowOffset:tOff];</span><br />
&#8230;</p>
<p>For what it&#8217;s worth, my situation was such that I was able to put the code to set the button in the <span style="font-family: Courier;">viewDidLoad</span> method.</p>
<p>One other thing to keep in mind when you&#8217;re loading your application from a nib, the ViewController&#8217;s initWithCoder is the initialization method that gets called.   Thanks to <a href="http://www.blumtnwerx.com/blog/2009/03/book-recommendation-beginning-iphone-development/">Jeff LaMarche</a> for the explanation of initializers in his response to <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/2364-question-about-initwithnibname.html">this question</a>.</p>
<p>Unless you just love writing and maintaining UI code, I strongly urge you to take a careful look at IB.   I&#8217;ll continue to use it whenever I can.</p>
<p>Technorati Tags:  <a rel="tag" href="http://technorati.com/tag/iPhone">iPhone</a> , <a rel="tag" href="http://technorati.com/tag/iPod+Touch">iPod Touch</a> , <a rel="tag" href="http://technorati.com/tag/Apple">Apple</a> , <a rel="tag" href="http://technorati.com/tag/mobile">mobile</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/03/musings-on-the-sometimes-maligned-interface-builder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

