<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mobile Orchard</title>
	
	<link>http://www.mobileorchard.com</link>
	<description>The iPhone App Developers' Blog: iPhone Programming, Developer News, Interviews And Tutorials</description>
	<pubDate>Fri, 10 Jul 2009 12:15:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MobileOrchard" type="application/rss+xml" /><feedburner:emailServiceId>MobileOrchard</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>This Week in iPhone News - July 10/2009</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/cUj4tRsE_JQ/</link>
		<comments>http://www.mobileorchard.com/this-week-in-iphone-news-july-102009/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 05:31:16 +0000</pubDate>
		<dc:creator>Ari Braginsky</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2459</guid>
		<description><![CDATA[
A fireside chat with Apple&#8217;s Jonathan Ive  Designer of the iMac, iPod, PowerBook, and more makes a public appearance.
What you can learn from a Palm developer  Some iPhone development tips from the Palm side of things.
Prowl  A Growl client for the iPhone.  Push notifications from your Mac or PC to your [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/07/handle.jpg" width="200" class="left frame"></p>
<p><a href="http://apple20.blogs.fortune.cnn.com/2009/07/01/a-fireside-chat-with-apples-jonathan-ive/">A fireside chat with Apple&#8217;s Jonathan Ive</a>  Designer of the iMac, iPod, PowerBook, and more makes a public appearance.</p>
<p><a href="http://bickbot.com/iphone/what-can-you-learn-from-an-old-school-palm-developer/">What you can learn from a Palm developer</a>  Some iPhone development tips from the Palm side of things.</p>
<p><a href="http://prowl.weks.net/">Prowl</a>  A Growl client for the iPhone.  Push notifications from your Mac or PC to your iPhone.</p>
<p><a href="http://www.grandtotal.biz/iPhoneSimulatorExchange/">iPhone Simulator Exchange</a>  Create 1-click installers of your iPhone Simulator apps for distributed testing and sharing.</p>
<p><a href="http://www.appleinsider.com/articles/09/07/08/apple_launches_http_live_streaming_standard_in_iphone_3_0.html">Apple launches HTTP Live Streaming standard in iPhone 3.0</a>  Interesting details and history behind Apple&#8217;s HTTP Live Streaming standard.</p>
<p><a href="http://iphonedevelopertips.com/xcode/testing-application-names-on-home-screen.html">Testing Application Names on Home Screen</a>  A handy tip for trying out what your application&#8217;s name will look like on the iPhone to avoid truncation issues.</p>
<p><a href="http://g4tv.com/thefeed/blog/post/697257/How-Many-iPhone-Games-Are-There-Over-13000.html">How Many iPhone Games Are There?</a>  Turns out there are a LOT of games on the App Store.</p>
<p><a href="http://www.pocketgamer.co.uk/r/iPhone/news.asp?c=14295">Average Price of a Top 10 iPhone Game</a>  Some more financial info on some of the top iPhone games.</p>
<p><a href="http://www.prweb.com/releases/news_search/iPhone_app/prweb2598654.htm">News Search App Allows iPhone-Wielding Citizens to Monitor Government Officials</a>  Search technology previously available only to the U.S. government and major corporations has been ported to the iPhone.</p>
<div style="font-size: 75%; margin-top: 1em">Photo credit: <a href="http://www.flickr.com/photos/ikoka/2145979604/sizes/o/">http://www.flickr.com/photos/ikoka/2145979604/sizes/o/</a></div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/cUj4tRsE_JQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/this-week-in-iphone-news-july-102009/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/this-week-in-iphone-news-july-102009/</feedburner:origLink></item>
		<item>
		<title>Corona: Easy-To-Implement, High Performance, Native iPhone Apps Written In Lua</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/mHDSdEx2rmg/</link>
		<comments>http://www.mobileorchard.com/corona-easy-to-implement-high-performance-native-iphone-apps-written-in-lua/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 18:41:04 +0000</pubDate>
		<dc:creator>Dan Grigsby</dc:creator>
		
		<category><![CDATA[Interviews]]></category>

		<category><![CDATA[Podcast]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2445</guid>
		<description><![CDATA[Bay Area Beginning iPhone Programming Workshop: July 30-31.  $799 with early bird price &#38; &#8220;mo&#8221; discount code.  Hurry: early bird price expires Weds!

Carlos Icaza and Walter Luh are the co-founders of Ansca Mobile and creators of Corona, a new &#038; much talked-about Lua based kit for building native iPhone applications.  
This interview [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-bottom: 10px; background-color: #def; border: 0.071em solid #ddd; padding: 5px; height: 40px"><img title="photo credit: http://www.flickr.com/photos/branditressler/2911306217/"  src="http://www.mobileorchard.com/wp-content/uploads/2009/06/ggb.jpg" height="40" align="right">Bay Area <a href="http://mobileorchard.com/training">Beginning iPhone Programming Workshop</a>: July 30-31.  <b>$799</b> with early bird price &amp; &#8220;mo&#8221; discount code.  Hurry: early bird price expires Weds!</div>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/07/corona.jpg" width="150px" class="left"></p>
<p>Carlos Icaza and Walter Luh are the co-founders of <a href="http://www.anscamobile.com/">Ansca Mobile</a> and creators of Corona, a new &#038; much talked-about Lua based kit for building native iPhone applications.  </p>
<p>This interview includes details about creating Corona; a comparison of the programming model, memory management, performance and optimization using Corona/Lua vs Cocoa Touch/Objective-C; and Adobe&#8217;s upcoming iPhone Flash products.</p>
<p>You can listen using the Flash player below, download the <a href="http://podcast.mobileorchard.com/podcast/019-Corona.mp3">MP3</a>, or subscribe to the iPhone Developer Podcast using the instructions at the bottom of this post.</p>
<p><object type="application/x-shockwave-flash" data="http://podcast.mobileorchard.com/wp-content/plugins/podcasting/player/player.swf" width="290" height="24" id="audioplayer1"><param name="movie" value="http://podcast.mobileorchard.com/wp-content/plugins/podcasting/player/player.swf" /><param name="FlashVars" value="playerID=1&amp;soundFile=http%3A%2F%2Fpodcast.mobileorchard.com%2Fpodcast%2F019-Corona.mp3" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /></object></p>
<p>For easy scanning of the interview, here is what was covered and when:</p>
<blockquote>
<ul style="font-size: 90%">
<li>1:00 Leaving Adobe and the path to creating Corona</li>
<li>4:00 Why Lua? Good for mobile: Code base small and good performance.  Accessible for people comfortable doing web-scripting.  Capable of handling serious engineering e.g., Photoshop Lightroom, World of Warcraft</li>
<li>7:00 Where does Lua stop and Corona begin?</li>
<li>8:45 Display layer atop OpenGL</li>
<li>9:15 Event/user-interaction mode (as compared e.g., to Cocoa Touch)</li>
<li>11:00 Memory management, garbage collection, memory consumption</li>
<li>12:45 Memory optimization for in-memory images</li>
<li>13:15 Graphics &#8220;painters&#8221; model</li>
<li>14:00 On-screen grouping</li>
<li>15:00 Getting started with Corona</li>
<li>15:30 What comes with the SDK</li>
<li>16:30 Interpreted on the phone?  Compiled to native code?  Some intermediate format?</li>
<li>19:00 Performance</li>
<li>21:30 Intended for &#8220;Flash-like&#8221; apps, or more broadly?</li>
<li>22:30 From here to 1.0: mostly about making it easy to get the code onto the device, making Internet calls</li>
<li><del>26:00 Flash on the iPhone scheduled for October&#8230;</del> [update: while Adobe is releasing Flash for a number of phones in October the iPhone doesn't appear to be one of them.] </li>
</li>
</blockquote>
<h3>Keep up to date with our iPhone developers&#8217; podcast</h3>
<p>Subscribe to our iPhone Development Podcast in one of two great ways:</p>
<ol>
<li><strong>Use the podcast&#8217;s feed with the feed app of your choice:</strong> <span style="font-family: -webkit-monospace;"><a href="http://podcast.mobileorchard.com/feed/podcast/">http://podcast.mobileorchard.com/feed/podcast/</a></span></li>
<li><strong>Subscribe using iTunes</strong> by <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=294369513">clicking here</a>.</li>
</ol>
<p>We hope you enjoy the podcast, and if you have any suggestions of who we should interview (or want to be interviewed yourself), use our <a href="/contact">Contact Page</a> or leave a comment below. Thanks for listening!</p>
<div style="font-size: 75%; margin-top: 1em">Music credit: <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?id=280716114&#038;s=143441">Silent Night by the Travesties</a></div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/mHDSdEx2rmg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/corona-easy-to-implement-high-performance-native-iphone-apps-written-in-lua/feed/</wfw:commentRss>
<enclosure url="http://podcast.mobileorchard.com/podcast/019-Corona.mp3" length="29770459" type="audio/mpeg" />
		<feedburner:origLink>http://www.mobileorchard.com/corona-easy-to-implement-high-performance-native-iphone-apps-written-in-lua/</feedburner:origLink></item>
		<item>
		<title>This Week in iPhone News - July 3/2009</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/i4eJR6nkYUo/</link>
		<comments>http://www.mobileorchard.com/this-week-in-iphone-news-july-32009/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 16:33:07 +0000</pubDate>
		<dc:creator>Ari Braginsky</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2434</guid>
		<description><![CDATA[
Trixel Postmortem  Very informative postmortem of the iPhone game &#8220;Trixel.&#8221;
Birdfeed  An alternative Twitter client for the iPhone.  Includes features such as: local caching, refresh timestamps, and SMS-style direct messages.
Here&#8217;s How iPhone App Store Ratings Work  More criticisms of the iPhone App Store.
Essential iPhone Memory Testing  Great tips for debugging memory [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/07/kid.jpg" width="200" class="left"></p>
<p><a href="http://www.gamasutra.com/php-bin/news_index.php?story=23802">Trixel Postmortem</a>  Very informative postmortem of the iPhone game &#8220;Trixel.&#8221;</p>
<p><a href="http://birdfeedapp.com/">Birdfeed</a>  An alternative Twitter client for the iPhone.  Includes features such as: local caching, refresh timestamps, and SMS-style direct messages.</p>
<p><a href="http://www.techcrunch.com/2009/06/29/heres-how-iphone-app-store-ratings-work-hint-they-dont/">Here&#8217;s How iPhone App Store Ratings Work</a>  More criticisms of the iPhone App Store.</p>
<p><a href="http://www.madeupsoftware.com/connected/blog/Entries/2009/6/28_Essential_iPhone_Memory_Testing.html">Essential iPhone Memory Testing</a>  Great tips for debugging memory issues.</p>
<p><a href="http://www.shacknews.com/featuredarticle.x?id=1156">John Carmack and Tom Mustaine on Doom, iPhone Desires, and the Future of id Mobile</a>  Engaging interview with the technical and business end of id software.</p>
<p><a href="http://mobiletcetra.com/2009/06/develop-native-iphone-apps-in-easiest-way/">Develop Native iPhone Apps Easily</a>  Corona is getting a lot of buzz.  The basics are covered in this informative article.  Our next podcast &#8212; due Sunday &#8212; is an interview with Corona&#8217;s creators.</p>
<p><a href="http://www.techcrunch.com/2009/06/30/recommend-your-favorite-iphone-apps-with-appsfire/?awesm=tcrn.ch_4u2&amp;utm_campaign=techcrunch&amp;utm_content=techcrunch-autopost&amp;utm_medium=tcrn.ch-twitter&amp;utm_source=direct-tcrn.ch">Recommend Your Favorite iPhone Apps with AppsFire</a>  Great new recommendation site for iPhone apps.</p>
<p><a href="http://iphonedevelopment.blogspot.com/2009/06/beginning-iphone-3-development.html">Beginning iPhone 3 Development</a>  A popular iPhone development book gets an upgrade and the author is candid about what changed from the last version.</p>
<p><a href="http://reviews.cnet.com/8301-19512_7-10276646-233.html">Apple Releases iPhone OS, SDK 3.1 Betas to Developers</a>  Not one to rest on their laurels, Apple released beta versions of iPhone OS 3.1 and iPhone SDK 3.1 this past Tuesday.</p>
<p><a href="http://gizmodo.com/5305260/iphone-os-31-features-better-video-editing-voice-control-over-bluetooth-and-more">iPhone OS 3.1 Features</a>  More details on what&#8217;s new with iPhone OS 3.1.</p>
<p><a href="http://parsekit.com/">Obj-C Framework for Parsing, Tokenizing, and Language Processing</a>  A handy framework you can use for parsing and other tasks for the iPhone.</p>
<p><a href="http://www.clarkcox.com/blog/2009/06/23/sdks-and-deployment-targets/">SDKs and Deployment Targets</a>  Easily build a single binary of your application such that it degrades gracefully on earlier platform versions.</p>
<p><a href="http://www.71squared.co.uk/2009/07/iphone-game-programming-tutorial-10-game-structure/">iPhone Game Programming - Game Structure</a>  Part 10 of a great video based tutorial series on iPhone game programming.</p>
<p><a href="http://digg.com/apple/iPhone_3GS_Smokes_Competition_in_OpenGL_Benchmarks">iPhone 3GS Smokes Competition in OpenGL Benchmarks</a>  OpenGL performance revealed for iPhone 3GS.</p>
<p><a href="http://www.prweb.com/releases/iphone/game/prweb2594594.htm">Student Startup Challenges Crowded iPhone App Store with Innovative Game</a>  It&#8217;s always a good idea to be original when developing a game for the iPhone in this crowded market.  See how a group of young students went about trying to do something new.</p>
<p><a href="http://www.iphonebuzz.com/iphone-3-1-better-video-editing-bluetooth-voice-control-vibrating-icon-moves-017778.php">iPhone 3.1 Enhancements</a>  More details on the new iPhone 3.1 update.</p>
<p><a href="http://www.australiaiphone.com/iphone-4-0-revealed-event-based-modes-scheduled-and-intellingent-device/">iPhone 4.0 Revealed</a>  4.0 you say?  Here&#8217;s a sneak peak at what&#8217;s coming next for the iPhone in the near future.</p>
<div style="font-size: 75%; margin-top: 1em">Photo credit: <a href="http://www.flickr.com/photos/mastrobiggo/2421862064/in/set-72157605058335391/">http://www.flickr.com/photos/mastrobiggo/2421862064/in/set-72157605058335391/</a></div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/i4eJR6nkYUo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/this-week-in-iphone-news-july-32009/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/this-week-in-iphone-news-july-32009/</feedburner:origLink></item>
		<item>
		<title>New In iPhone 3.0 Tutorial Series, Part 3: Copy &amp; Paste With UIPasteboard</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/jW4QDpG39L0/</link>
		<comments>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-3-copy-paste-with-uipasteboard/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 22:04:13 +0000</pubDate>
		<dc:creator>Dan Grigsby</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Resources]]></category>

		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2414</guid>
		<description><![CDATA[
Welcome to part-3 of our New In iPhone 3.0 Tutorial/Programming Series.  The previous two articles in this series covered in-app email and shake to undo/redo.  
This time, we&#8217;ll cover the basics of reading-from and writing-to the pasteboard.
Pasteboard Overview
Multiple Pasteboards
There isn&#8217;t just one pasteboard on the iPhone:  
There are two system pasteboards:  [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/07/copy.gif" class="left" width="250"></p>
<p>Welcome to part-3 of our New In iPhone 3.0 Tutorial/Programming Series.  The previous two articles in this series covered <a href="http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/">in-app email</a> and <a href="http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-1-shake-to-undoredo-nsundomanager/">shake to undo/redo</a>.  </p>
<p>This time, we&#8217;ll cover the basics of reading-from and writing-to the pasteboard.</p>
<h3>Pasteboard Overview</h3>
<p><b>Multiple Pasteboards</b></p>
<p>There isn&#8217;t just one pasteboard on the iPhone:  </p>
<p>There are two system pasteboards:  a <em>General</em> system-wide pasteboard that&#8217;s used for copy-paste operations and  a <em>Find</em> pasteboard that holds the last search string.</p>
<p>Additionally, applications can create their own pasteboards that can be used by other apps.  For example, a <a href="http://www.pingysoft.com/site/Ring_It_Up.html">point-of-sales app</a> and a <a href="http://www.innerfence.com/apps/credit-card-terminal">credit card terminal app</a> could use a shared pasteboard to pass payment details back and forth.</p>
<p><b>Multiple Representations</b></p>
<p>An item added to the pasteboard has a <em>type</em>.  More precisely, when an item is added to the pasteboard it has representations in one or more types.  A web address, for example, could be stored as both a string and also a URL.  </p>
<p>Storing multiple representations in the pasteboard allows for flexibility in how the item is used.  An email client could use the text representation to plunk a readable NSString representation of the URL into the body of a message; a podcast app could consume the NSURL representation to fetch the podcast.</p>
<p>This approach isn&#8217;t unique to the iPhone.  This design lets the same copy operation in Safari result in plain text in TextMate but formatted text in Pages.</p>
<h3>Pasteboard Operations</h3>
<p>Note: the examples in this tutorial will use the General pasteboard though, because all pasteboards ares subclasses of the <code>UIPasteboard</code> class, the programming model applies to any pasteboard.</p>
<p><b>Using The General Pasteboard</b></p>
<p>The <code>generalPasteboard</code> class method returns a pointer the general pasteboard &#8212; for these examples, I&#8217;ll have set the <code>pasteboard</code> variable thusly:</p>
<p><code>
<pre>
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
</pre>
<p></code></p>
<p><b>Convenience Properties</b></p>
<p>The most common pasteboard operations involve getting or setting strings, images, URLs and colors.  Apple provides convenience getters/setters for these in the form of properties:</p>
<p><code>
<pre>
NSString *string = pasteboard.string;
UIImage *image = pasteboard.image;
NSURL *url = pasteboard.URL;
UIColor *color = pasteboard.color;

pasteboard.string = @"paste me somewhere";
</pre>
<p></code></p>
<p><b>Determining If A Type Of Representation Is Available</b></p>
<p>The getter methods return nil if there isn&#8217;t a representation of the item in that type.  It&#8217;s handy to know ahead of time whether a representation in a particular type is available.  Use the <code>containsPasteboardTypes:</code> method to check:</p>
<p><code>
<pre>
if ([pasteboard containsPasteboardTypes: [NSArray arrayWithObject:@"public.utf8-plain-text"]])
	NSLog(@"String representation present: %@", pasteboard.string);
</pre>
<p></code></p>
<p>For a list of all the types for an item, use <code>pasteboardTypes</code>.</p>
<p><b>Uniform Type Identifiers &#8212; UTIs &#8212; Signify Type</b></p>
<p>The previous example checked for the <em>public.utf8-plain-text</em> type to determine if a string was present.  This is an example of a UTI, or Uniform Type Identifier.  For info on UTIs, read Apple&#8217;s <a href="http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html"> Uniform Type Identifiers Overview</a> document.</p>
<p>Apple provides constants for common types in UTCoreTypes.h.  To use the constants:</p>
<blockquote>
<ol style="font-size: 90%">
<li>Add the MobileCoreServices framework to your project</li>
<li>#import &lt;MobileCoreServices/MobileCoreServices.h&gt;
</ol>
</blockquote>
<p>The constants are of type <code>CFStringRef</code>.  You&#8217;ll work with them as NSStrings.  The CFStringRef type is a fancy way of representing strings for both C and Objective-C.  To use them in Objective-C simply cast them:</p>
<p><code>
<pre>
NSString *urlUTIType = (NSString *)kUTTypeURL;
</pre>
<p></code></p>
<p>You&#8217;re free to make up your own for your own data types; Apple recommends you use reverse-DNS notation style (e.g., <em>com.mobileorchard.mySnazzyType</em>) to ensure uniqueness.</p>
<p><b>Setting And Retrieving Types That Lack Convenience Getters/Setters</b> </p>
<p>The convenience getters/setters are just a syntactic nicety.  Essentially, they function the same as using the <code> valueForPasteboardType:</code> and <code>setValue:forPasteboardType</code> methods:</p>
<p><code>
<pre>
NSString *string = [pasteboard valueForPasteboardType:@"public.utf8-plain-text"];
[pasteBoard setValue:@"paste me somewhere" forPasteboardType:@"public.utf8-plain-text"];
</pre>
<p></code></p>
<p>These methods are intended for strings, arrays, dictionaries, dates, numbers and URLs.  The <code>dataForPasteboardType</code> and <code>setData:forPasteboardType:</code> methods are available for other types.</p>
<p><b>Storing An Item With Multiple Representations</b></p>
<p>Using the convenience setters/properties has a significant limitation: items are stored with a single type.  If, using our example from above, we want to store a URL as both a NSString as well as a NSURL we need to construct a dictionary of types and their values and set the pasteboard&#8217;s items property:</p>
<p><code>
<pre>
static NSString *string = @"http://www.mobileorchard.com";
NSDictionary *item = [NSDictionary dictionaryWithObjectsAndKeys:
	string, @"public.utf8-plain-text", [NSURL URLWithString:string],
	(NSString *)kUTTypeURL,
	nil];
pasteboard.items = [NSArray arrayWithObject:item];
</pre>
<p></code></p>
<p>Now, both <code>pasteboard.string</code> and <code>pasteboard.url</code> will return items.</p>
<p><b>Pasteboards Support Multiple Items</b></p>
<p>Note that, in the last example, we&#8217;re setting the <em>items</em> &#8212; plural &#8212; property.  To keep this tutorial simple, I treated the pasteboard as a single-item entity.  Should you require it, you can get/set arrays of items from the pasteboard.  It&#8217;s generally straightforward to do so, usually involving little more than creating/consuming arrays pluralizing the property/method names.  Check the docs for details.</p>
<div style="margin-bottom: 10px; background-color: #def; border: 0.071em solid #ddd; padding: 5px; height: 40px"><img title="photo credit: http://www.flickr.com/photos/branditressler/2911306217/"  src="http://www.mobileorchard.com/wp-content/uploads/2009/06/ggb.jpg" height="40" align="right"><a href="http://mobileorchard.com/training">Mobile Orchard Beginning iPhone Programming Workshop</a>. Bay Area, July 30-31.  $999 early bird registration.  Save $200 with &#8220;mo&#8221; discount code.</div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/jW4QDpG39L0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-3-copy-paste-with-uipasteboard/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-3-copy-paste-with-uipasteboard/</feedburner:origLink></item>
		<item>
		<title>Lite To Paid iPhone Application Data Migrations With Custom URL Handlers</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/pWqM6Mpdtj4/</link>
		<comments>http://www.mobileorchard.com/lite-to-paid-iphone-application-data-migrations-with-custom-url-handlers/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 17:58:05 +0000</pubDate>
		<dc:creator>Stephen Lombardo</dc:creator>
		
		<category><![CDATA[Resources]]></category>

		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2397</guid>
		<description><![CDATA[Stephen Lombardo and Zetetic are the creators of the encrypted iPhone data vault Strip.

Apple enforces a number of restrictions on applications in the App Store. Among the most painful is the lack of feature-limited trials. Applications are either completely free, or the customer must pay up front, sight unseen. The proliferation of &#8220;Lite&#8221; applications is [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-bottom: 10px; background-color: #def; border: 0.071em solid #ddd; padding: 5px;">Stephen Lombardo and <a href="http://zetetic.net/">Zetetic</a> are the creators of the encrypted iPhone data vault <a href="http://zetetic.net/products/strip">Strip</a>.</div>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/migration.jpg" class="left"></p>
<p>Apple enforces a number of restrictions on applications in the App Store. Among the most painful is the lack of feature-limited trials. Applications are either completely free, or the customer must pay up front, sight unseen. The proliferation of &#8220;Lite&#8221; applications is a direct result of this shortcoming. Publishers will often create two application versions: the first is fully functional but costs money, the second is &#8220;Lite&#8221; and comes with limited features but zero price tag. The goal is for prospective customers to try the free version first and then decide to buy the paid full version separately if they like it.</p>
<p>Because free applications have greater exposure this approach is <a href="http://toucharcade.com/2009/01/13/ishoot-takes-the-number-1-spot-in-app-sales/">widely advocated</a> as a means to increase visibility and grow sales. When building a game or other stateless application the approach makes complete sense. However, utility applications often maintain information entered by the device owner. Application authors are faced with a dilemma because the iPhone&#8217;s security sandbox prevents one application from reading another application&#8217;s files. Thus, when customers upgrade from the Lite application they are penalized by having to re-enter all data!</p>
<p>When we developed our data vault product, <a href="http://zetetic.net/products/strip/its-strip">Strip</a>, we felt this situation was unacceptable. We wanted to offer <a href="http://zetetic.net/products/strip/its-striplite">Strip Lite</a>, free for people to try, limited to 10 entries. Upgrading customers should be able to import their data from the Lite version. No pain.</p>
<h3>The Approach</h3>
<p>Strip stores user data in an <a href="http://www.zetetic.net/software/sqlcipher">encrypted SQLite Database</a>. Since we really wanted a way to copy the data file from Strip Lite to Strip we developed a fairly clever solution: use a registered <span class="caps">URL</span> handler as a means of communication between application versions. This is how it works:</p>
<blockquote>
<ol>
<li>A customer downloads Strip Lite for free and enters some unique private data. All information is written to a database in the application&#8217;s document directory.</li>
<li>When the 10 record limit is hit Strip Lite asks them to upgrade. An upgrade button launches to explain the process and allow the user to download the paid version of the product.</li>
<li>Once Strip is purchased and installed, our customer will launch Strip Lite and click an &#8220;Export to Strip&#8221; button. Strip Lite reads the application database into an NSData object, Base64 encodes it and then Launches a &#8220;strip://&#8221; <span class="caps">URL</span> with the encoded file contents as a <span class="caps">URL</span> parameter. </li>
<li>The full version of Strip is registered as a handler for &#8220;strip://&#8221; URLs. The OS launches Strip and passed the <span class="caps">URL</span> to the handleOpenURL method of the application delegate. It parses and decodes the data and writes the database to the desired location in the new applications Document folder.</li>
<li>Our customer now has access to all the data the originally entered into Strip Lite!</li>
</ol>
</blockquote>
<h3>Project Setup</h3>
<p>This tutorial assumes that your project is already configured with two targets, one for your full version, and one for the Lite.</p>
<p>Start by creating a new InfoLite.plist file for your Lite version. We use 2 separate .plist files to ensure that the Full version is the only registered <span class="caps">URL</span> handler (we don&#8217;t want the Lite version responding to upgrade events itself!). It is easiest to just make a copy of the existing Info.plist file named InfoLite.plist.</p>
<p>Next, Open up the Build preferences for the Lite target. Change the <strong>Info.plist File</strong> property to read InfoLite.plist. This will ensure that the Lite target includes the proper file.</p>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/xcode_build.png" /></p>
<p>Now open the <strong>Info.plist</strong> (used by the Full Version) and register a custom <span class="caps">URL</span> handler. This is a straightforward process of adding elements as shown in the following screenshot.</p>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/info_plist.png"/></p>
<p>Please note that the <span class="caps">URL</span> identifier and <span class="caps">URL</span> scheme must be unique for your application &#8212; see this stepwise overview of <a href="http://www.mobileorchard.com/apple-approved-iphone-inter-process-communication/">the process</a> for reference.</p>
<p>Finally, the application must include code to perform Base64 encoding itself. This functionality is, unfortunately, not directly accessible in the framework <span class="caps">SDK</span>. There are a few options in Cocoa, including <a href="http://www.dribin.org/dave/blog/archives/2006/03/12/base64_cocoa/">using OpenSSL&#8217;s libcrypto</a>, but the easiest method is to use the encoding libraries from <a href="http://code.google.com/p/google-toolbox-for-mac/">Google Toolbox for Mac</a> which is conveniently distributed under the Open Source Apache License. Download <a href="http://google-toolbox-for-mac.googlecode.com/svn/trunk/GTMDefines.h">GTMDefines.h</a>, <a href="http://google-toolbox-for-mac.googlecode.com/svn/trunk/Foundation/GTMBase64.h">GTMBase64.h</a> and <a href="http://google-toolbox-for-mac.googlecode.com/svn/trunk/Foundation/GTMBase64.m">GTMBase64.m</a>, then add them to your project. The <span class="caps">GTM</span> code compiles perfectly on the iPhone and even includes web safe variants that are immediately suitable for use in URLs without percent encoding.</p>
<h3>The Code</h3>
<p>With the project setup complete the Paid version will respond to the custom <span class="caps">URL</span> launch! This will facilitate an export from the Lite version to be received by the Full version.</p>
<h4>The Lite Version</h4>
<p>The Lite application should be extended to add a button to trigger the export on an about, settings, or upgrade page.</p>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/export-data.png" /></p>
<p>The controller action code will read the data file, encode it and then format a <span class="caps">URL</span> with the protocol prefix / <span class="caps">URL</span> scheme configured in the previous step.</p>
<pre>
#import "GTMBase64.h"
...
NSData *fileData = [NSData dataWithContentsOfFile:@"/path/to/LiteApplication/Documents/file"];
NSString *encodedString = [GTMBase64 stringByWebSafeEncodingData:fileData padded:YES];
NSString *urlString = [NSString stringWithFormat:@"myapp://localhost/importDatabase?%@", encodedString];
NSURL *openURL = [NSURL URLWithString:urlString];
[[UIApplication sharedApplication] openURL:openURL];
</pre>
<h4>The Full Version</h4>
<p>The final step is to make your application handle the Open <span class="caps">URL</span> event and reverse the encoding process.</p>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/strip-upgrade.png" /></p>
<p>Add a handleOpenURL method to the AppDelegate implementation as follows. This will receive the <span class="caps">URL</span>, sanity check it, and then parse the query string directly. The resulting binary data is written to the file in the full application&#8217;s data directory.</p>
<pre>
#import "GTMBase64.h"
...
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    if([@"/importDatabase" isEqual:[url path]]) {
        NSString *query = [url query];
        NSString *importUrlData = [GTMBase64 webSafeDecodeString:query];

        // NOTE: In practice you will want to prompt the user to confirm before you overwrite their files!
        [importUrlData writeToFile:@"/path/to/FullApplication/Documents/file" atomically:YES];
        return YES;
    }
    return NO;
}
</pre>
<h3>End Game</h3>
<p>We have transferred files of up to 100k this way, and the size of a <span class="caps">URL</span> string is theoretically only limited <a href="http://www.benzado.com/blog/post/28/iphone-openurl-limit">by available memory</a>. That said, this approach is most suitable for applications with small to medium size data transfer requirements. Best of all though, it can be easily used for SQLite databases, <span class="caps">XML</span> files, text files, or even extended to handled compressed archives.</p>
<p>Strip has seen steady growth since it&#8217;s release as people upgrade from <a href="http://zetetic.net/products/strip/its-striplite">Strip Lite</a> to <a href="http://zetetic.net/products/strip/its-strip">the full version</a>. Based on download reports and direct comments from customers we believe that much of this is directly attributable to the simple upgrade path. Until (and if at all) Apple begins to allow in-app purchases from within free applications this is a simple and painless way to migrate data between Lite and Paid application versions.</p>
<div style="font-size: 75%; margin-top: 1em">Photo credit: <a href="http://www.flickr.com/photos/waltjabsco/2428106795/">http://www.flickr.com/photos/waltjabsco/2428106795/</a></div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/pWqM6Mpdtj4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/lite-to-paid-iphone-application-data-migrations-with-custom-url-handlers/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/lite-to-paid-iphone-application-data-migrations-with-custom-url-handlers/</feedburner:origLink></item>
		<item>
		<title>This Week in iPhone News - June 26/2009</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/hKiPs95lSoA/</link>
		<comments>http://www.mobileorchard.com/this-week-in-iphone-news-june-262009/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:30:40 +0000</pubDate>
		<dc:creator>Ari Braginsky</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2376</guid>
		<description><![CDATA[
Demographics and Behavioral Characteristics of iPhone and iPod  Users  Interesting data from AdMob and comScore.
New iPhone Users with Activation Headaches Get iTunes Credit  Apple apologizes for the 3G S activation woes.
Pinch Media Watcher  Pinch Media releases a native iPhone SDK application for viewing your application&#8217;s stats.
The Fable of Free More testimonies [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/ntr23/sets/72157604712390523/"><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/lego.jpg" class="left frame" title="Lego People Unboxing An iPhone - A photo set on Flickr"></a></p>
<p><a href="http://blog.admob.com/2009/06/16/new-research-on-the-demographics-and-behavioral-characteristics-of-iphone-and-ipod-touch-users-from-admob-and-comscore/">Demographics and Behavioral Characteristics of iPhone and iPod  Users</a>  Interesting data from AdMob and comScore.</p>
<p><a href="http://arstechnica.com/apple/news/2009/06/new-iphone-users-with-activation-headaches-get-itunes-credit.ars?utm_source=microblogging&amp;utm_medium=arstch&amp;utm_term=Main%20Account&amp;utm_campaign=microblogging">New iPhone Users with Activation Headaches Get iTunes Credit</a>  Apple apologizes for the 3G S activation woes.</p>
<p><a href="http://www.pinchmedia.com/pinch-media-watcher-iphone-application-released/">Pinch Media Watcher</a>  Pinch Media releases a native iPhone SDK application for viewing your application&#8217;s stats.</p>
<p><a href="http://www.clickz.com/3634152">The Fable of Free</a> More testimonies from the iPhone developer trenches regarding free apps.</p>
<p><a href="http://support.apple.com/kb/HT3630">iPhone 3.0 Features</a>  Which iPhone 3.0 software features does your iPhone support?  Take a look at this handy guide from Apple.</p>
<p><a href="http://www.techcrunch.com/2009/06/23/iphone-in-app-purchases-already-leading-to-the-dreaded-two-words-bait-and-switch/?awesm=tcrn.ch_4QD&amp;utm_campaign=techcrunch&amp;utm_content=techcrunch-autopost&amp;utm_medium=tcrn.ch-twitter&amp;utm_source=direct-tcrn.ch">Bait and Switch with In-App Purchases</a>  Something to consider from a user&#8217;s perspective when implementing in-app purchases with your iPhone app.</p>
<p><a href="http://www.gearlog.com/2009/06/att_iphone_coverage_getting_be.php">AT&amp;T: iPhone Coverage Getting Better, Faster Soon</a>  As we all know, AT&amp;T coverage can be spotty.  AT&amp;T hopes to remedy this &#8220;soon&#8221;.</p>
<p><a href="http://googleblog.blogspot.com/2009/06/announcing-adsense-for-mobile.html">AdSense for Mobile Applications (Beta)</a>  Integrate AdSense into your mobile application with Google&#8217;s new beta.</p>
<p><a href="http://t-machine.org/index.php/2009/06/11/may-2009-survey-of-iphone-developers/">Survey of iPhone Developers</a>  Great compilation of data from a recent iPhone developer survey.</p>
<p><a href="http://www.techcrunch.com/2009/06/24/iphone-3gs-javascript-performance-blows-away-rivals-approaches-macbook-speed/?awesm=tcrn.ch_4b2&amp;utm_campaign=techcrunch&amp;utm_content=techcrunch-autopost&amp;utm_medium=tcrn.ch-twitter&amp;utm_source=direct-tcrn.ch">iPhone 3GS JavaScript Performance</a>   JavaScript speed test results on the new iPhone 3G S, and they don&#8217;t look too shabby.</p>
<p><a href="http://gizmodo.com/5301885/we-dont-need-no-gmail-iphone-app-gmail-mobile-adds-touch-gestures">Gmail Mobile Adds Touch Gestures</a>  Google implements in-browser gestures for its updated mobile application.</p>
<p><a href="http://blog.mobilegamesblog.com/2009/06/ansca-brings-flash-competitor-to-iphone.html">Flash Competitor for iPhone</a>  Ex-Adobe vets launch Corona, a Flash alternative that may run on the iPhone in the near future.</p>
<p><a href="http://www.iphonedevcamp.org/">iPhone Dev Camp</a>  I will be most likely attending this event July 31st - August 2nd in Sunnyvale, CA at the Yahoo headquarters.  Won&#8217;t you join me?</p>
<div style="margin-bottom: 10px; background-color: #def; border: 0.071em solid #ddd; padding: 5px; height: 40px"><img title="photo credit: http://www.flickr.com/photos/branditressler/2911306217/"  src="http://www.mobileorchard.com/wp-content/uploads/2009/06/ggb.jpg" height="40" align="right"><a href="http://mobileorchard.com/training">Mobile Orchard Beginning iPhone Programming Workshop</a>. Bay Area, July 30-31.  $999 early bird registration.  Save $200 with &#8220;mo&#8221; discount code.</div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/hKiPs95lSoA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/this-week-in-iphone-news-june-262009/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/this-week-in-iphone-news-june-262009/</feedburner:origLink></item>
		<item>
		<title>Announcing: The Unofficial iPhone SDK Feedback Project</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/lMM-zLz4xU4/</link>
		<comments>http://www.mobileorchard.com/announcing-the-unofficial-iphone-sdk-feedback-project/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 04:05:37 +0000</pubDate>
		<dc:creator>Dan Grigsby</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2373</guid>
		<description><![CDATA[
A couple of days ago, I received a note from James DonFrancesco about an unexpected behavior change introduced in iPhone 3.0:  
In 2.X, apps could launch a tel:// url to dial the phone without user input.  In 3.0, Apple introduced a verification box to obtain user permission when an tries to make an [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/feedback.png" class="left" width="250"></p>
<p>A couple of days ago, I received a note from James DonFrancesco about an unexpected behavior change introduced in iPhone 3.0:  </p>
<p>In 2.X, apps could launch a tel:// url to dial the phone without user input.  In 3.0, Apple introduced a verification box to obtain user permission when an tries to make an outbound call.</p>
<p>This change breaks James&#8217; <a href="http://precognitiveresearch.com/content/baby_alert_pro/">baby monitor app</a> &#8212; which makes calls parents when their kids wake &#8212; and diminishes the user experience of the whole genre of specialty dialer apps.  </p>
<p>James, reasonably, wanted to gather a posse of similarly effected people to to collectively lobby Apple for a change; perhaps convince them to borrow from the Core Location user experience and let users grant apps permission to dial without validation.  </p>
<p>James&#8217; situation is a specific example of a larger pattern to address: there isn&#8217;t an acceptable way for iPhone developers to constructively provide feedback <em>with gravity</em>.  </p>
<p>Sure, Apple takes bug reports.  However, the system is effectively opaque.  Is the submitter alone with his/her issue, or does it effect a silent majority of developers?  Furthermore, while bugs are objectively resolvable, they&#8217;re a subset of the much larger category of subjective <em>feedback</em>, e.g., policy/behavior changes.</p>
<p>There is evidence that Apple responds to constructive feedback:  They dropped the NDA, they&#8217;ve reversed app  rejections (e.g., Eucalyptus), and there are reports that <a href="http://www.marco.org/122990476">they actively try to avoid bad blood</a>.  </p>
<p>So, to provide the iPhone developer community with a mechanism to collectively submit constructive feedback with gravity to Apple, I&#8217;m pleased to announce:</p>
<h3><a href="http://sdkfeedback.mobileorchard.com">The Unofficial iPhone SDK Feedback Project</a></h3>
<p>The fine folks at <a href="http://uservoice.com">UserVoice</a> have provided us with a system for collecting feedback:</p>
<p>Anyone may submit feedback; the community then votes on the issues, producing a stack-ranking of the most important items on the minds of iPhone developers.  </p>
<p>Developers can also enlist their app&#8217;s users to vote for more gravity.</p>
<p>The system functions as an <em>economy</em>: you have a limited number of votes, forcing you to make spending choices, concentrating feedback.  With enough participation, the system will function as an efficient market, accurately indicating what&#8217;s on our collective minds.</p>
<p>Of course, without your participation this is for naught.  Contrary to conventional wisdom, you can beat city hall &#8212;  I personally, literally beat city hall in a fight this month.  Apple can be moved too.  </p>
<p>For further motivation:  I&#8217;ll be running a new, regular feature here on Mobile Orchard highlighting new/hot/interesting feedback activity.  So go make your voices heard!</p>
<div style="font-size: 75%; margin-top: 1em">Photo credit: <a href="http://www.flickr.com/photos/gr3m/1477917884/">http://www.flickr.com/photos/gr3m/1477917884/</a>, from a presentation by Daniel Burka</div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/lMM-zLz4xU4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/announcing-the-unofficial-iphone-sdk-feedback-project/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/announcing-the-unofficial-iphone-sdk-feedback-project/</feedburner:origLink></item>
		<item>
		<title>New In iPhone 3.0 Tutorial Series, Part 2: In App Email, MessageUI</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/L4N-arzWtd0/</link>
		<comments>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 20:21:54 +0000</pubDate>
		<dc:creator>Dan Grigsby</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Resources]]></category>

		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2362</guid>
		<description><![CDATA[
Welcome back!  In the first part of this series, I showed how to implement Shake To Undo/Redo and NSUndoManager in an iPhone app.  
This time, we&#8217;ll add in-app email to a simple iPhone application using the new-in-3.0 MessageUI framework.
Technically neither mail from an app nor MessageUI are new.  MessageUI was a private [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/in-app-email1.png" class="left"></p>
<p>Welcome back!  In the first part of this series, I showed how to implement <a href="http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-1-shake-to-undoredo-nsundomanager/">Shake To Undo/Redo and NSUndoManager</a> in an iPhone app.  </p>
<p>This time, we&#8217;ll add in-app email to a simple iPhone application using the new-in-3.0 MessageUI framework.</p>
<p>Technically neither mail from an app nor MessageUI are new.  MessageUI was a private framework prior to 3.0, and apps could send mail using mailto:// URLs, though in a limited way. </p>
<p>In any case, with 3.0 and MessageUI, sending messages is straightforward and full featured.</p>
<p>We&#8217;ll start with working code for a simple app with a UI containing a single button.  We&#8217;ll add code that shows the compose-an-email message UI and pre-fills the subject and content when the button is pressed.</p>
<p><b>Source/GitHub</b></p>
<p>The <a href="http://github.com/dcgrigsby/InAppEmail/tree/">code for this tutorial</a> is available on GitHub.  To download a copy for yourself, close the repository:</p>
<blockquote>
<ol style="font-size: 90%">
<li>Open a terminal and change to the directory where you want the code</li>
<li>Clone the repo by typing <em>git clone git://github.com/dcgrigsby/InAppEmail.git</em></li>
</ol>
</blockquote>
<p>I&#8217;ve made two separate commits to the repository &#8212; an initial commit without in-app email, and a second one with those capabilities added.  If you&#8217;re following along step-by-step, you&#8217;ll want to revert to the earlier commit.  From the source directory:</p>
<blockquote>
<ol style="font-size: 90%">
<li>Type <em>git checkout 0019071d855e6d3a9f263b8a02d9c7d93dc5dcd2</em></li>
</ol>
</blockquote>
<p><b>Orientation</b></p>
<p>InAppEmail is about as simple an application as it&#8217;s possible to construct.  The single &#8220;Send Email&#8221; button &#8212; which is disabled, for now &#8212; triggers the <code>buttonPressed</code> message when pressed.  </p>
<p><b>Adding The MessageUI Framework</b></p>
<p>As part of the MessageUI Framework, Apple provides a ready-made compose-a-message UI called <code>MFMailComposeViewController</code> for our use.  In order to use it, we need to add the MessageUI Framework to our project:</p>
<blockquote>
<ol style="font-size: 90%">
<li>In the <em>Groups &amp; Files</em> panel of the project, expand the InAppEmail project branch</li>
<li>Control-click or right-click the <em>Frameworks</em> folder</li>
<li>Choose <em>Add &gt; Existing Frameworks&#8230;</em></li>
<li>Expand the <em>Frameworks</em> folder</em></li>
<li>Choose <em>MessageUI.framework</em> and click <em>Add</em></li>
<li>Click <em>Add</em> once more</li>
</ol>
</blockquote>
<p>Next, import the framework in the header:</p>
<blockquote>
<ol style="font-size: 90%">
<li>Add <em>#import &lt;MessageUI/MessageUI.h&gt;</em> to InAppEmailViewController.h</li>
</ol>
</blockquote>
<p><b>Showing The MFMailComposeViewController UI</b></p>
<p><code>MFMailComposeViewController</code> is just like any other view controller; we can use <code>presentModalViewController</code> from our InAppEmailViewController class to slide it onto the screen modally.</p>
<p>Replace the <code>puttonPressed</code> method in InAppEmailController.m with this:</p>
<p><code></p>
<pre>
- (IBAction)buttonPressed {
	MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
	[controller setSubject:@"In app email..."];
	[controller setMessageBody:@"...a tutorial from mobileorchard.com" isHTML:NO];
	[self presentModalViewController:controller animated:YES];
	[controller release];
}
</pre>
<p></code></p>
<p>Running the app in its current form would be disappointing.  The &#8220;Send Email&#8221; message button is disabled.  It&#8217;s a simple matter to enable it but, but we should do so <em>only</em> if the iPhone or iPod touch the app is running on has been configured to send mail.   To do so, add code for a<code>viewDidLoad</code> method to InAppEmailViewController.m:</p>
<p><code></p>
<pre>
- (void)viewDidLoad {
	if ([MFMailComposeViewController canSendMail])
		button.enabled = YES;
}
</pre>
<p></code></p>
<p><b>Dismissing the MFMailComposeViewController UI</b></p>
<p>We&#8217;re most of the way there.  Run the app at this juncture and it mostly works: clicking the button brings up the compose UI pre-filled with our sample message.  Add an email address in the &#8220;To&#8221; field and away you go &#8212; mostly:</p>
<p>We&#8217;re missing one piece: we need to know when to dismiss the mail composer UI.  The <code>MFMailComposeViewControllerDelegate</code> protocol provides a callback mechanism to accomplish this.  </p>
<p>To receive the callback, we&#8217;ll need:</p>
<blockquote>
<ol style="font-size: 90%">
<li>Adopt the protocol in our InAppEmailViewController</li>
<li>Set ourselves up as the delegate to receive the callbacks</li>
<li>Implement the callback method</li>
</ol>
</blockquote>
<p>To adopt the protocol update InAppEmailViewController.h.  Changes are bold:</p>
<p><code></p>
<pre>
#import &lt;UIKit/UIKit.h&gt;

@interface InAppEmailViewController : UIViewController <b>&lt;MFMailComposeViewControllerDelegate&gt;</b> {
	IBOutlet UIButton *button;
}

- (IBAction)buttonPressed;

@end
</pre>
<p></code></p>
<p>To set ourselves up as the delegate to receive the callbacks update <code>buttonPressed</code> in InAppEmailViewController.m.  Changes are bold:</p>
<p><code></p>
<pre>
- (IBAction)buttonPressed {
	MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
	<b>controller.mailComposeDelegate = self;</b>
	[controller setSubject:@"In app email..."];
	[controller setMessageBody:@"...a tutorial from mobileorchard.com" isHTML:NO];
	[self presentModalViewController:controller animated:YES];
	[controller release];
}
</pre>
<p></code></p>
<p>Finally, we implement the callback method.  Add this code for a <code>mailComposeController:didFinishWithResult:error:</code> method to InAppEmailViewController.m:</p>
<p><code></p>
<pre>
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
	[self becomeFirstResponder];
	[self dismissModalViewControllerAnimated:YES];
}
</pre>
<p></code></p>
<p><b>Conclusion</b></p>
<p>That covers the basics.  This tutorial doesn&#8217;t demonstrate setting recipients, adding attachments, or composing HTML email &#8212; all of which are straightforward once you&#8217;ve got the basics down.</p>
<p>Finally, one limitation that&#8217;s worth noting: you can&#8217;t force a user to send mail; they can always click the cancel button.</p>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/L4N-arzWtd0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/</feedburner:origLink></item>
		<item>
		<title>Push Notification &amp; Store Kit - An Interview With Urban Airship</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/oPjFAXtR-3Q/</link>
		<comments>http://www.mobileorchard.com/push-notification-store-kit-an-interview-with-urban-airship/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 17:23:37 +0000</pubDate>
		<dc:creator>Dan Grigsby</dc:creator>
		
		<category><![CDATA[Interviews]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[Podcast]]></category>

		<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2349</guid>
		<description><![CDATA[Mobile Orchard Beginning iPhone Programming Workshop. Bay Area, July 30-31.  $999 early bird registration.  Save $200 with &#8220;mo&#8221; discount code.

iPhone 3.0 has arrived, and with it push notification and in-app purchase.  
In this interview, Scott Kveton, Michael Richardson and Steven Osborn of  Urban Airship talk about the ins and outs of [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-bottom: 10px; background-color: #def; border: 0.071em solid #ddd; padding: 5px; height: 40px"><img title="photo credit: http://www.flickr.com/photos/branditressler/2911306217/"  src="http://www.mobileorchard.com/wp-content/uploads/2009/06/ggb.jpg" height="40" align="right"><a href="http://mobileorchard.com/training">Mobile Orchard Beginning iPhone Programming Workshop</a>. Bay Area, July 30-31.  $999 early bird registration.  Save $200 with &#8220;mo&#8221; discount code.</div>
<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/urbanairship.jpg" class="left"></p>
<p>iPhone 3.0 has arrived, and with it push notification and in-app purchase.  </p>
<p>In this interview, Scott Kveton, Michael Richardson and Steven Osborn of  <a href="http://www.urbanairship.com">Urban Airship</a> talk about the ins and outs of these new capabilities, the challenges of maintaining server infrastructure as an iPhone developer, and their services that seek to alleviate those pain points.</p>
<p>You can listen using the Flash player below, download <a href="http://podcast.mobileorchard.com/podcast/018-urban-airship.mp3">the MP3</a>, or subscribe to the iPhone Developer Podcast using the instructions at the bottom of this post.  </p>
<p><object type="application/x-shockwave-flash" data="http://podcast.mobileorchard.com/wp-content/plugins/podcasting/player/player.swf" width="290" height="24" id="audioplayer1"><param name="movie" value="http://podcast.mobileorchard.com/wp-content/plugins/podcasting/player/player.swf" /><param name="FlashVars" value="playerID=1&amp;soundFile=http%3A%2F%2Fpodcast.mobileorchard.com%2Fpodcast%2F018-urban-airship.mp3" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /></object></p>
<p>For easy scanning of the interview, here is what was covered and when:</p>
<ul>
<li>1:30 - Urban Airship offering</li>
<li>2:30 - Push notification overview</li>
<li>3:30 - Urban Airship handling push notification for Tap-Tap revenge</li>
<li>4:00 - Implementing push notification without a service like Urban Airship</li>
<li>4:30 - Send JSON messages, persistent connection, device tokens/feedback service for unsubscribe</li>
<li>5:00 - What&#8217;s missing in the sample implementation in Apple&#8217;s forums that demonstrate push notification in a dozen lines of code?</li>
<li>5:45 - Feeback service for managing &#8220;inactive&#8221; devices</li>
<li>7:15 - Persistent connections</li>
<li>8:30 - Implementing push via Urban Airship</li>
<li>12:00 - Building a relationship with Apple</li>
<li>13:00 - In app purchase </li>
<li>13:30 - Connecting receipt info to a content download after in-app purchase</li>
<li>14:00 - 3-10% of users use the app over the long term; the in-app purchase creates an additional revenue stream from those folks</li>
<li>15:00 - Pricing model</li>
<li>17:00 - A free option?</li>
<li>18:30 - Options for in app purchase: embedded content/features, downloadable content/feature</li>
<li>19:30 - Advantages/disadvantages of embedding the content in the app</li>
<li>21:30 - Purchase request programming model</li>
<li>25:45 - Consumable and non-consumable items</li>
<li>27:00 - Apple review process for in-app purchases</li>
</ul>
<h3>Keep up to date with our iPhone developers&#8217; podcast</h3>
<p>Subscribe to our iPhone Development Podcast in one of two great ways:</p>
<ol>
<li><strong>Use the podcast&#8217;s feed with the feed app of your choice:</strong> <span style="font-family: -webkit-monospace;"><a href="http://podcast.mobileorchard.com/feed/podcast/">http://podcast.mobileorchard.com/feed/podcast/</a></span></li>
<li><strong>Subscribe using iTunes</strong> by <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=294369513">clicking here</a>.</li>
</ol>
<p>We hope you enjoy the podcast, and if you have any suggestions of who we should interview (or want to be interviewed yourself), use our Contact page or leave a comment against this post. Thanks for listening!</p>
<h3>About Our Theme Music</h3>
<p>Like the riff that opens the show?  Buy the full song <a href="https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/tellAFriend?id=280716114&#038;type=2">on iTunes</a>. </p>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/oPjFAXtR-3Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/push-notification-store-kit-an-interview-with-urban-airship/feed/</wfw:commentRss>
<enclosure url="http://podcast.mobileorchard.com/podcast/018-urban-airship.mp3" length="20729564" type="audio/mpeg" />
		<feedburner:origLink>http://www.mobileorchard.com/push-notification-store-kit-an-interview-with-urban-airship/</feedburner:origLink></item>
		<item>
		<title>This Week in iPhone News - June 19/2009</title>
		<link>http://feedproxy.google.com/~r/MobileOrchard/~3/Yb06YMVQLms/</link>
		<comments>http://www.mobileorchard.com/this-week-in-iphone-news-june-192009/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 04:57:10 +0000</pubDate>
		<dc:creator>Ari Braginsky</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mobileorchard.com/?p=2340</guid>
		<description><![CDATA[
AppStore HQ  A comprehensive mobile app store aggregator.
How the iPhone can overtake all gaming handhelds in five steps  The iPhone sure is poised to grow, especially in the gaming space.
iPhone install base vs. console install base  Interesting comparison between how many people have iPhones compared to gaming consoles.
The Awesome Potential of iPhone [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mobileorchard.com/wp-content/uploads/2009/06/mine.png" class="left"></p>
<p><a href="http://www.appstorehq.com/">AppStore HQ</a>  A comprehensive mobile app store aggregator.</p>
<p><a href="http://news.cnet.com/8301-17938_105-10263483-1.html">How the iPhone can overtake all gaming handhelds in five steps</a>  The iPhone sure is poised to grow, especially in the gaming space.</p>
<p><a href="http://kotaku.com/5287694/iphone-install-base-vs-console-install-bases">iPhone install base vs. console install base</a>  Interesting comparison between how many people have iPhones compared to gaming consoles.</p>
<p><a href="http://blog.flurry.com/bid/22501/The-Awesome-Potential-of-iPhone-In-App-Purchases">The Awesome Potential of iPhone In-App Purchases</a>  Now that iPhone 3.0 is out, it&#8217;s an exciting time to see what developers do to take advantage of the new in-app purchasing feature.</p>
<p><a href="http://oreilly.com/catalog/9780596805265/">iPhone Game Development (Rough Cuts Version)</a>  The first book that I&#8217;ve seen that exclusively covers game development for the iPhone.</p>
<p><a href="http://www.pcworld.com/businesscenter/article/166556/10_cool_things_about_the_iphone_3g_s.html">10 cool things about the iPhone 3G S</a>  Living under a rock?  With the new iPhone 3.0 operating system launching this week, and the new hardware launching today, take a look at some of the coolest features that are now available.</p>
<p><a href="http://www.informationweek.com/news/personal_tech/iphone/showArticle.jhtml?articleID=217801029"> Apple iPhone Developers Mostly Don&#8217;t Make Much Money</a>  A sobering article on one developer&#8217;s experiences with making a living as an iPhone developer.</p>
<p><a href="http://theappera.com/2009/06/12/wwdc-2009-apple-app-rating-system-goes-live-quietly/?utm_source=Twitter&amp;utm_medium=Social&amp;utm_campaign=wwdc-2009-apple-app-rating-system-goes-live-quietly">The Apple App Rating System Goes Live</a>  Some information on the new ratings system that the upgraded iTunes will now support, including more across the board support for adult titles.</p>
<p><a href="http://www.techcrunch.com/2009/06/10/aurora-feint-to-roll-out-openfeint-20-a-social-gaming-platform-for-the-iphone/">Aurora Feint to Roll Out OpenFeint 2.0</a>  Thinking of adding XBox Live like features to your game?  Want your game connected with other games?  Take a look at this new version of a social gaming platform for the iPhone.</p>
<p><a href="http://www.stromcode.com/2009/05/24/the-incredible-app-store-hype/">The Incredible App Store Hype</a>  More sobering data regarding making a living as an iPhone developer.</p>
<p><a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=9134159&amp;source=CTWNLE_nlt_dailyam_2009-06-10">What do Snow Leopard, iPhone 3G S, iPhone 3.0 mean for business?</a>  An enterprise view on the new upgrades from Apple.</p>
<p><a href="http://www.tuaw.com/2009/06/15/wolfram-alpha-now-has-an-iphone-portal/">Wolfram|Alpha now has an iPhone portal</a>  Now access this amazing new &#8220;knowledge&#8221; engine (it&#8217;s not a search engine) from your iPhone.</p>
<p><a href="http://www.gamasutra.com/php-bin/news_index.php?story=23785">Secret Exit on the Rise of iPhone and Why Cellphone Games Don&#8217;t Work for Indies</a>  A candid interview with the creators of the award winning &#8220;Zen Bound&#8221; game for the iPhone.</p>
<p><a href="http://www.marco.org/122990476">Trust, hostility, and the human side of Apple</a>  The perspective of an Apple developer and their frustrations.</p>
<p><a href="http://www.appleinsider.com/articles/09/06/17/att_drops_iphone_3g_s_prices_for_early_iphone_3g_adopters.html">AT&amp;T drops iPhone 3G S prices for early iPhone 3G adopters</a>  There&#8217;s a lot of controversy between previous iPhone owners and AT&amp;T with regards to upgrading to iPhone 3G S.  AT&amp;T has announced, for a limited time, the opportunity to purchase one at the same price points as new customers.</p>
<div style="font-size: 75%; margin-top: 1em">Photo credit: <a href="http://www.flickr.com/photos/envision/3085397880/">http://www.flickr.com/photos/envision/3085397880/</a></div>
<img src="http://feeds.feedburner.com/~r/MobileOrchard/~4/Yb06YMVQLms" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.mobileorchard.com/this-week-in-iphone-news-june-192009/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.mobileorchard.com/this-week-in-iphone-news-june-192009/</feedburner:origLink></item>
	</channel>
</rss>
