<?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>Karl Kraft &#187; iPhone</title>
	<atom:link href="http://www.karlkraft.com/index.php/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.karlkraft.com</link>
	<description>Just a 2 bit programmer in a 64 bit world</description>
	<lastBuildDate>Thu, 24 Jun 2010 14:20:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to Panic people in line for the iPhone 4G</title>
		<link>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/</link>
		<comments>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 14:20:16 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=145</guid>
		<description><![CDATA[I arrived at the Apple store at The Domain in Austin this morning about 6:30.  The lines were so long there was no point in trying to get into line quickly, so I decided to spend a few minutes counting the number of people in line. As I went down the lines counting, I could [...]]]></description>
			<content:encoded><![CDATA[<p>I arrived at the Apple store at The Domain in Austin this morning about 6:30.  The lines were so long there was no point in trying to get into line quickly, so I decided to spend a few minutes counting the number of people in line.</p>
<p><span id="more-145"></span>
<p>As I went down the lines counting, I could not believe the amount of stress that I induced in those being counted.  People quickly began to worry about whether they were too far back in line to get a phone, or even if they were in the right line.  I was stopped about every 25 people asking what their number in line was. I had to explain over and over that I wasn&#8217;t counting for any purpose.</p>
<p>For the record, by the time 7 AM rolled around there were 700 total people in the two lines.  During that time I&#8217;m sure the line grew, because I started with the no-reservation line first, and then proceeded to the reserved line, which wound around the building in a different direction.  Between 7AM and 7:20, another 82 people showed up in the reserved line behind me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A tool for splitting app sales</title>
		<link>http://www.karlkraft.com/index.php/2009/10/29/a-tool-for-splitting-app-sales/</link>
		<comments>http://www.karlkraft.com/index.php/2009/10/29/a-tool-for-splitting-app-sales/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 16:02:44 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=119</guid>
		<description><![CDATA[For the past few months I have been using MyAppSales to track my day to day sales volume of my iPhone applications. In a recent update the developer, Oliver Drobnik aka Dr. Touch, added the ability to see your total sales. I have kept all the weekly sales reports going back to when my applications [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few months I have been using <a href="http://www.drobnik.com/touch/my-app-sales/">MyAppSales</a> to track my day to day sales volume of my iPhone applications.  In a  recent update the developer, Oliver Drobnik aka Dr. Touch, added the ability to see your total sales. </p>
<p>I have kept all the weekly sales reports going back to when my applications were first available.  So I was hoping I would finally be able to see my grand total for each app.  The only problem is that the grand total is based on daily reports, not weekly reports.<br />
<span id="more-119"></span>So I created a small command line tool called <a href="http://www.karlkraft.com/wp-content/uploads/2009/10/SplitWeek.zip" title="SplitWeek.zip">SplitWeek</a> that would break each week file into 7 daily files.</p>
<p>Each sale is assigned randomly to one of the seven days in the weekly period, so there are no rounding errors.</p>
<p>Operation is simple.  Just run the command from Terminal, passing the path to the weekly file as the first argument:</p>
<pre>
<b>./build/Debug/SplitWeek reports/S_W_20080825.txt</b>
</pre>
<p>The 7 files will then be generated and saved to the current working directory.</p>
<pre>
2009-10-29 11:05:36.933 SplitWeek[53735:903] S_D_20080825.txt
2009-10-29 11:05:36.934 SplitWeek[53735:903] S_D_20080826.txt
2009-10-29 11:05:36.935 SplitWeek[53735:903] S_D_20080827.txt
2009-10-29 11:05:36.935 SplitWeek[53735:903] S_D_20080828.txt
2009-10-29 11:05:36.936 SplitWeek[53735:903] S_D_20080829.txt
2009-10-29 11:05:36.937 SplitWeek[53735:903] S_D_20080830.txt
2009-10-29 11:05:36.937 SplitWeek[53735:903] S_D_20080831.txt
</pre>
<p>Once you have created all your daily files, zip them up, and upload them to MyAppSales using the web server built in to the application.</p>
<p>And speaking of the built in web server, here is a quick tip on how to connect to it.  When you enable the server, it will show the IP and port you need to enter into Safari to connect.  In the screen shot here, I&#8217;m using the simulator, so it doesn&#8217;t even give an IP.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2009/10/MyAppSales_1.png" alt="MyAppSales_1.png" border="0" width="339" height="154" /></p>
<p>Instead of entering the IP and port, just use the Safari Bonjour support, and you will find it listed under Webpages.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2009/10/MyAppSales_2.png" alt="MyAppSales_2.png" border="0" width="175" height="248" /></p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2009/10/MyAppSales_3.png" alt="MyAppSales_3.png" border="0" width="307" height="178" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2009/10/29/a-tool-for-splitting-app-sales/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet another iPhone Emergency Call Security Bug</title>
		<link>http://www.karlkraft.com/index.php/2008/10/03/yet-another-iphone-emergency-call-security-bug/</link>
		<comments>http://www.karlkraft.com/index.php/2008/10/03/yet-another-iphone-emergency-call-security-bug/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 14:15:22 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=105</guid>
		<description><![CDATA[iPhone Emergency Call has a security bug in the way it handles SMS messages]]></description>
			<content:encoded><![CDATA[<p>My twelve year old son brought to my attention a security bug he discovered on his iPhone.  He has an even more paranoid security mind than I do, because he primarily uses his iPhone to send and receive sweet nothings between himself and his girlfriend, and he is certain that his mother and I are desperate to intercept these messages.</p>
<p><span id="more-105"></span></p>
<p>Being security conscious he turned on the passcode lock and disabled SMS Preview.  </p>
<p>This screen shot shows the SMS preview disabled:</p>
<p><a href="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083337-0500-1.png"" ><br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083337-0500-1.png" alt="Screenshot 2008-10-03 08:33:37 -0500-1.png" border="0" width="160" height="240" /><br />
</a></p>
<p>This enables a mandatory passcode.  If a message is received during the passcode entry or while the screen is locked, a generic message of &#8220;New Text Message&#8221; appears, to prevent viewing of messages without unlocking the phone:</p>
<p><a href="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083308-0500-1.png"" ><br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083308-0500-1.png" alt="Screenshot 2008-10-03 08:33:37 -0500-1.png" border="0" width="160" height="240" /><br />
</a></p>
<p><a href="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083601-0500-1.png"" ><br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083601-0500-1.png" alt="Screenshot 2008-10-03 08:33:37 -0500-1.png" border="0" width="160" height="240" /><br />
</a></p>
<p>If however the phone is placed in emergency call mode, any incoming SMS messages are previewed instead of presented as the generic messages.  Thus all I need to do to intercept the messages from his girlfriend is to place the phone in emergency mode and wait 30 seconds for the next sickly sweet message.  </p>
<p><a href="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083736-0500-1.png"" ><br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/10/rowid-varchar12-screenshot-2008-10-03-083736-0500-1.png" alt="Screenshot 2008-10-03 08:33:37 -0500-1.png" border="0" width="160" height="240" /><br />
</a></p>
<p>This was in iPhone version 2.1 (5F136), the currently shipping version.  Since I have no access to beta of non-released firmwares I can&#8217;t test to see if it has been fixed since then.  For those how care, this is bug 6267416.  I don&#8217;t have much hope for it being fixed soon, because my security bug 5368148 from July of 2007 is still marked as open, and still unfixed in 10.5.5.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/10/03/yet-another-iphone-emergency-call-security-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HazMat &#8211; a Development Story</title>
		<link>http://www.karlkraft.com/index.php/2008/09/12/hazmat-a-development-story/</link>
		<comments>http://www.karlkraft.com/index.php/2008/09/12/hazmat-a-development-story/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 20:57:42 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=100</guid>
		<description><![CDATA[A detailed story of the writing of HazMat with a spreadsheet full of numbers.]]></description>
			<content:encoded><![CDATA[<p>At the end of August my first iPhone application HazMat went on sale via the iTunes App Store.  During the past 6 months I have been having private conversations with various individuals about the development process and the resulting sales experience, and I thought it might be useful to others to collect this in a narrative about the application.  My goal is to give a full open view about the problems, pitfalls and pleasures of writing iPhone applications.</p>
<p>Send questions via <a href="mailto:karl@karlkraft.com">email</a></p>
<p>Those of you solely interested in my sales number can <a href="http://www.karlkraft.com/wp-content/uploads/2008/09/salesnumbers.zip" title="Sales.numbers.zip">check them here</a>.</p>
<p><span id="more-100"></span></p>
<h3>Background</h3>
<p>I have been writing Objective-C code since the early days of NeXTSTEP (20 years).  I work as a contractor and it is one of my many &#8220;day jobs&#8221;, along with system administration for LAMP systems, and a few other odds and ends.  I also have to deal with other languages like Java, Perl, Python, PHP, and so on.</p>
<p>Development on the iPhone is almost exclusively Objective-C.  You might think that I would have an extreme advantage, but honestly I don&#8217;t think so.  Objective-C is easy to pick up if you have any C based language development experience, including C++, C#, or even something like PHP.</p>
<p>Yes the syntax is different.  Every language has a different syntax, but it is all the same bits and pieces such as loops, conditionals, assignments, functions, etc.</p>
<p>Yes the framework is different, but then again, most of the iPhone UIKit framework is not a one to one match for the Cocoa AppKit framework. </p>
<p>So my Objective-C experience gave me a good start, but I know several people who have picked it up with little work, even when coming in with little to know serious programming experience.</p>
<p>I bought 2 iPhones on the day they were released and gave them as gifts to a client.  But with no development path I couldn&#8217;t see buying one for myself.</p>
<p>When jailbreaking became a real possibility and tool chains and documentation started to appear, I finally bought a phone for myself and my wife.</p>
<p>I paid tangental attention to the open source tool chain, and then when the October announcement of a pending real SDK came out, I set aside plans to build apps until the real SDK was released.</p>
<h3>Becoming an iPhone Developer</h3>
<p>As the SDK announcement approached, I began to track programs on other mobile platforms, and began to think of potential applications to write.  I also started to make guesses and observations about what the iPhone development ecosystem would be like.</p>
<p>In most cases I guessed right.  In quite a few I got it wrong, or I have no idea whether I&#8217;m right or wrong.  I&#8217;ll discuss that more later on.  But the important point is that if you want to have any kind of success as an iPhone developer you need to think about the future of the platform and be prepared for the change, because the iPhone ecosystem is still undergoing radical changes.  Items like push notification have been off, on, and off-again.</p>
<p>I felt that using my personal iPhone for day to day development probably wasn&#8217;t the best route, so I ordered another iPhone, and an iPod Touch as well.</p>
<p>I applied for the developer program right when it was announced.  In the first 2 weeks it seemed that no one was approved.  Then rumors of approval started to filter out, and the assumption was that Apple was processing them on some fair basis, such as first come first served, or approving ADC Premier members first.  Neither ended up being the case.  I was in the same boat as many other developers, with no idea why I wasn&#8217;t being approved, or what I could do to help the process.</p>
<p>I downloaded each version of the SDK, and worked on some early code. </p>
<h3>WWDC</h3>
<p>In 2007 I had attended WWDC, but now I found myself facing a dilemma.  I still hadn&#8217;t been accepted as an iPhone developer, and the primary reason to attend WWDC would be to learn more about iPhone development, and one-on-one interactions with Apple engineers about iPhone development.  I sent a note off to ADC about the problem with attending WWDC without being able to develop for the iPhone, and got the equivalent of a &#8220;just wait&#8221; notice.</p>
<p>At the time the simulator was even worse than it is now.  Major features like Open GLES simply did not work in the simulator, and those are the exciting aspects of the iPhone.  Given my background, getting to play with a simulated NSDictionary and some simulated buttons wasn&#8217;t something I would need help with at the WWDC level.</p>
<p>I ended up not attending WWDC.  A friend of mine (ADC Premier) got accepted as an iPhone developer less than 2 weeks before WWDC.  It was at this point that I started to really notice what I call the &#8220;If the guards have stopped my beatings, they must have stopped all the beatings of everyone else as well.&#8221; mentality.  His assumption was that since he had gotten his developer accepts, I must have gotten mine.  An alternate assumptions was that everyone going to WWDC was getting one. </p>
<p>Unfortunately neither was true.  I ended up getting mine a few days after July 11th when the App Store opened.  I know people who attended WWDC who got accepted even later than myself.</p>
<p>In general Apple did a poor job of communicating about the process of becoming an iPhone developer, and they are still doing a poor job.  And by communicating, I mean they are just not responding to some questions.  They seem to be trying to be deliberating opaque in their answers, walking a path around the truth instead of just explaining this clearly. </p>
<p>An example of this is the $99 fee for the Apple iPhone Developer program. Many are still confused as to whether this is an annual fee or one time fee.  As I have previously participated in Apple Developer programs, I was expecting it to be an annual fee.  But I still see new developers coming to the platform who aren&#8217;t sure, and the signup pages for the program are very unclear.  They just say &#8220;Standard Program $99&#8243;. </p>
<p>While Apple does have a press release that causally mentions it is a yearly fee, that doesn&#8217;t make it obvious, and one would think that if the question keeps coming up, Apple would be more active in addressing it on the iPhone Developer signup pages.  A $99 yearly fee should not be treated like a source of shame.</p>
<h3>An iPhone Developer</h3>
<p>Once I had been accepted as a developer I went through the process of generating the various keys, getting certificates, and provisioning profiles.  I had about 90% of the application written at this point, and I fired it up on the iPhone.</p>
<p>The results were not good.</p>
<p>Because the simulator runs at native Desktop speeds, it cannot be used to get an idea of the performance of your application.  And HazMat, which ran perfectly acceptably in the simulator was slower than molasses on an actual test device.</p>
<p>This is another one of those items were there just doesn&#8217;t seem to be any kind of pro active communication from Apple, and with the NDA still in effect, I&#8217;m discouraged from publishing my own experimental benchmarks that might help other developers get realistic expectations out of their product ideas.</p>
<p>But enough negativity.  Let&#8217;s talk about the development.</p>
<h3>HazMat Was Three Projects </h3>
<p>The first project was to gather and clean the raw data. This consisted of some data in spreadsheets, others in PDF files, and other in CSV files.  I had to clean up typos, oddities and the such and get the data into a common set of CSV files. </p>
<p>The second project was to take the CSV files and get them translated into a SQLite database.  This second project would lead me to discover errors in the first project, and I would cycle back and forth between the two projects.</p>
<p>The third project was the actual iPhone application which then reads the data from the SQLite database and displays the result.  This then lead to another revelation about the data needing to be massaged for performance and display quality.  About 30 commodities had very poor name choices.  For instance Gasoline is also called Gasohol,which while it is shorter is more confusing to United States users.  So I had to hand mark preferred names for certain commodities.</p>
<p>I also at this point started using the app myself, and learning more about particular usability features and performance.  A redesign was done for the detail display to break it into General Info, Fire, Spill, and First Aid instead of one long page. </p>
<p>I did the icon work myself using Photoshop and Adobe Illustrator.  A lot of images were based on inspiration from various Google image searches, and the App icon is based off a set of free HazMat placards done in Adobe Illustrator by <a href="http://ian-albert.com/misc/hazmat.php">Ian Albert</a>.  The original icon was a NFPA icon, but I ended up changing it when I pulled the NFPA data from the application.</p>
<p>Many items were pulled from the first version of the application, because I quickly saw HazMat becoming a huge time sink.  I perform development and system administration services as my livelihood, and I already knew at this point that HazMat would not only be a niche application, but probably the most niche application in the AppStore, and that meant a very small amount of income for a lot of work.  I decided it would be better to get a solid first version out, and then add more sections to the first screen as time went on.  That way it could continue to be a part time effort from me, that wouldn&#8217;t burn me out.</p>
<p>When it came to sales, I also had in mind a specific idea of how many units of HazMat whould actually sell.  Unlike a game or a productivity utility HazMat has a very narrow audience.  My estimate was 2-3 copies s day, with maybe a peak of 14 or so at the beginning.  I also formed a mental benchmark of 40 per day as the number at which I was wrong about my estimates.</p>
<h3>Pricing</h3>
<p>Based on my guess of 3 copies a day average, I guessed maybe a thousand copies in the first year. To recoup my actual time I would have to charge what I felt was an unreasonable amount of money.  I felt that while releasing it for free would result in a lot of people downloading the application it wouldn&#8217;t provide any benefit to me, not even a psychological boost. </p>
<p>While 99 cents was an option, I quickly saw it becoming the &#8220;price of crap&#8221; in the App Store.  Chris Rock tells a joke about minimum wage, in which he points out that</p>
<blockquote><p> &#8220;You know what that means when someone pays you minimum wage?  You know what your boss was trying to say? It&#8217;s like &#8220;Hey if I could pay you less, I would, but its against the law&#8221;.
</p></blockquote>
<p>So it is with the 99 cent price. It acts like a signal that the developer wants something, but that the application would be cheaper than 99 cents but Apple won&#8217;t let them charge less.  I understand the dilemma for Apple. It is hard to make profit on 10 cent internet sales that cost 25 cents to process. </p>
<p>In the end I decided to go with pure signaling with the application.  I choose the $3.99 price to signify that the application was a significant body of work designed for a specific audience.  I didn&#8217;t choose it to maximize revenue, or because I did great research, or to match price in other mobile devices.  I choose it as a pure signal.  I believed then and now that I would have the same number of sales of the app whether I priced at 99 cents or $7.99.  $3.99 just sent the right signal.</p>
<p>I would have considered 99 cents if there was a way to raise the price and charge for upgrades, where I could slowly raise the price as the value of the app increases.  But that isn&#8217;t an option in the AppStore and likely won&#8217;t ever be an option.</p>
<p>So in the final analysis, over the next 3 years, I might make $2.80 per copy, with about 3000 copies being sold.  That comes to $8,400.00 over 3 years.  That works out to PFV of about $7,500.00 which is about how much time I have put into the application.  I&#8217;ll probably put another $15,000.00 of work into the application over that same time period.  In short this application is a money loser, but a labor of love and a personal itch.  A hobby of time.</p>
<p>All of this was capped with me needing to actually get all the banking information setup in expectation of maybe getting an occasional wire transfer from Apple.  For such a small amount, I almost wish they would have given me the option of taking it in Apple Store credit.</p>
<h3>Submitting the App</h3>
<p>Submitting the app took a couple of tries.  Learning how codesigning work, and how to use the codesign command line utility is essential, because when Xcode is not setup correctly it will say the build succeeded even when it didn&#8217;t sign the application.</p>
<p>The ApplicationLoader used to submit the zip file also produces some cryptic and misleading error messages. On the positive side it does detect several common errors such as incorrect icon sizes, or invalid zip files.</p>
<p>I work on about two dozen Cocoa applications, so I have a common build and deployment script and practice, where all development builds have a DEVELOPMENT version number, and the build process changes the Info.plist in the app wrapper during deployment.  Those builds are done on an old G5 that I have stuck in a corner.  It regularly builds each svn repository, detects deployment versions, does the app-casting and so on.</p>
<p>However the G5 can&#8217;t build iPhone applications, and even though I have a half dozen Intel boxes, they are all in active use and not ready for corner of the closet retirement.</p>
<p>So I built the application by hand, and forgot to change the version from DEVELOPMENT to something else.  IIRC, the Application Loader detected this and rejected the binary and explained the version number was invalid.  So I changed it to &#8220;1&#8243;, and then rebuilt.  Unlike my other build process I can&#8217;t change it after it is built because the Info.plist is one of the signed resources.</p>
<p>I submitted version &#8220;1&#8243; and then waited.</p>
<p>About 2 days later my application still showed &#8220;Waiting for Upload&#8221;.  I have gotten the distinct impression that all the pieces of the App Store are not directly linked.  It seems common for people to report that their application says &#8220;Waiting for Upload&#8221; for hours after they upload and &#8220;In Review&#8221; even when it has gone on sale.  Again something I wish Apple would be clearer about.</p>
<p>But after 2 days I figured there might be a problem.  So I sent an email.  At about the same time, Apple was sending an email to me.</p>
<h3>Rejected</h3>
<p>The version number &#8220;1&#8243; is not allowed.  </p>
<p>Apple sent me a paragraph that detailed the requirement for version numbers, which basically requires they have a decimal point.  So &#8220;1.0&#8243; is valid, &#8220;1&#8243; is not.  Foolishly I figured that if Application Loader knew that &#8220;DEVELOPMENT&#8221; was not valid, it would have told me if &#8220;1&#8243; was invalid as well.</p>
<p>So I carefully read the rules and resubmitted with a date encoded version number &#8220;2008.08.18&#8243;.  Normally I don&#8217;t do this for OSX applications, but with the mandatory review process it is unlikely I will ever have 2 versions submitted on the same day.</p>
<p>So I submitted, and the next day checked.  &#8220;In Review&#8221;</p>
<p>And then waited, and waited.</p>
<p>Again, there is that feeling that maybe they forgot my application.  So everyday I would login, check, see the In Review, and then work on breathing and meditation exercises.</p>
<p>Finally in the early evening of August 29th , I got the email that my application had been approved and was now available for sale.  It still showed &#8220;In Review&#8221;, and I couldn&#8217;t find it in the App Store.  However I took them at their word and quickly worked up the web site, and a simple FAQ, and then waited.</p>
<p>Later that night I could finally find it in the US App Store, but not in some foreign stores.  My belief is that again the process is not a instant worldwide single button deployment, but rather a series of loosely connected systems.  I went to sleep happy.</p>
<p>The version posted to the store was the previously not allowed version number &#8220;1&#8243;. I would let Apple know, but who can I communicate with in a timely manner about this mistake that could possible solve it?</p>
<h3>The Sales, The Reviews, The Spreadsheet</h3>
<p>The next morning I got up and checked iTunes Connect to see whether I sold a copy. Incredibly I had sold 3 copies. Two in the US, and one in Canada.  Pretty much right on target.  I congratulated myself on my wonderful prediction.</p>
<p>I also started to notice reviews.  Two of the first reviews were complaints that it should have been free, and another that it was overpriced that it should have been 99 cents, but that I was basically smoking crack if I thought I would sell any copies at $3.99.  After some meditation and breathing exercises I got over it.  Rather than sock puppet a bunch of reviews, or post my own railing at their lack of understanding of capitalism and economics, I instead found solace in two items.</p>
<p>First, I clipped their comments down and posted them on my web site as endorsements.</p>
<p>Second, except for those pointless whining rants, the rest of the reviews were from people who like the app, and were mostly giving it five stars.  It seems I had hit an app that at least a few people wanted or appreciated.  I also got two emails from people expressing their pleasure with the application, and pointing out ideas for future versions.</p>
<p>The next morning, I logged into iTunes Connect to see how I did on my first full day of sales.</p>
<p>91 copies, with 76 in the United States.</p>
<p>That was a lot more than I was expecting.  I put it down to a big first day boost, and went back to work on other projects.  I was sure that by tomorrow it would be down to my previously mindset value of 14 or below, or at the most 40 or so, all depending on whether it was a quick crash or soft landing down to 3 copies.</p>
<p>Instead the next day it was 86 copies.  Still way larger than I expected.  Sales continued for the next several weeks to be higher than expected.  After 2 weeks I&#8217;m still not below 14 copies.  Instead I seem to have soft landed at about 25 copies a day.  I started watching and graphing the values on a Numbers spreadsheet.</p>
<p>That third day was August 31st.  I added up my sales to that point and realized that I had made $389.00 in royalties.  While not enough to retire on, it was still a pleasant surprise.  That meant that I should be getting a check for my two-ish days of sales in August.  From other posts I had heard that Apple takes about 10 days to settle on the sales, and then about 10-15 days later actual transfers the money.  The idea of getting a &#8220;check&#8221; at the end of September helped sooth the logical part of my mind that said this was not a business project but rather a hobby.</p>
<p>The total for the first 14 days is $1,541.23 of which about $278.43 is in miscellaneous foreign currencies that aren&#8217;t large enough for Apple to perform the wire transfer.</p>
<p>My expectations were and remain so low, that each day I wake up to gleefully check iTunes Connect for sales figures.</p>
<h3>The Check</h3>
<p>On September 10th, I got the email from Apple indicating that the actual financial reports for August payments were ready for download.  I expected that there might be a small discrepancy, but was interested in finding out how close to the $389.00 amount the payment would be.</p>
<p>The answer was a bit depressing.  No check.  No payment, $53 US sales.  And onesie-twosie sales in other regions. </p>
<p>I sent a note to the email address for the payment people.  For all my previous moaning above about the lack of communication with Apple regarding the development side, let me say that the payment and contracts people are the exact opposite. Every email I have sent them has been very quickly replied to, and questions are honestly and completely answered on the very first response.  That group seems to have the process down to machine like precision.</p>
<p>I had made 2 incorrect assumptions.  The first is that August meant 8/1 to 8/31. Apple doesn&#8217;t pay on calendar month, but rather on financial month (<a href="http://www.karlkraft.com/wp-content/uploads/2008/09/apple-fy08.pdf" title="Apple FY08.pdf">2008</a> <a href="http://www.karlkraft.com/wp-content/uploads/2008/09/apple-fy09.pdf" title="Apple FY09.pdf">2009</a>).  The contract and payments group was kind enough to send me the exact financial calendar they use.  Not only for this financial year, but next financial year as well.  For August of this year, the financial month was 8/3 to 8/30.</p>
<p>But even with the calendaring mistake I sold more than $53 worth on 8/30 alone.  My second mistake was in thinking that the delay from 9/1 to 9/9 in getting reports out was to settle all the outstanding credit card charges, since Apple doesn&#8217;t charge credit cards at the same time the end user downloads HazMat.</p>
<p>Instead that time is just for them to reconcile all the transactions.  So downloads on 8/30 are transactions, but only some of them are financial sales.  Those people who got credit card receipts via email on 8/30 count, those that Apple didn&#8217;t charge till 8/31 or 9/1 don&#8217;t count.</p>
<p>In the end, I&#8217;ll still get paid, just at the end of October instead of September.</p>
<h3>Bullets in Hindsight</h3>
<ul>
<li>I didn&#8217;t make a lot, but more than I thought, and it is nowhere near as I expected.
<li> Niche apps can sell on the store.  Even though Apple is promoting games, there are people who want other items.
<li> Was it better to write something niche that isn&#8217;t likely to be duplicated, or better to write something everyone can understand because it isn&#8217;t unique?
<li> I was in books.  This meant I stayed on the front page longer.
<li>The iPhone shows the first 5 apps without scrolling. iTunes shows the first 21.  Moving to number 6 didn&#8217;t decrease sales.  Moving to number 22 did.  More people buy on the desktop than on the phone.  However I dropped to #22 on 9/11, so can&#8217;t be sure if that was the contributing factor.
<li> Some of the people who downloaded my app probably have no interest in hazardous materials, but found the application to be appealing because of the sense of a source of &#8220;secret&#8221; information.
<li>Getting listed at the end of the month sucks.
<li>You will get bad reviews no matter want.  Don&#8217;t let the bozos get you down.
<li>The NDA didn&#8217;t stop me from writing code, but it does stop me from sharing 20 years of experience as it relates to this platform.
<li>There are lots of reasons to sit and whine about iPhone development, there are a thousand reasons to pound out the code.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/09/12/hazmat-a-development-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HazMat &#8211; My first Published iPhone Application</title>
		<link>http://www.karlkraft.com/index.php/2008/08/30/hazmat-my-first-published-iphone-application/</link>
		<comments>http://www.karlkraft.com/index.php/2008/08/30/hazmat-my-first-published-iphone-application/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 17:31:33 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=96</guid>
		<description><![CDATA[One of the companies I work for deals with international shipping. One of the most interesting parts of that job is watching all the weird and dangerous commodities that ship across the roads, rails, and sea. While most people are blissfully ignorant of what signs like these on a side of a truck mean, I [...]]]></description>
			<content:encoded><![CDATA[<p>One of the companies I work for deals with international shipping.  One of the most interesting parts of that job is watching all the weird and dangerous commodities that ship across the roads, rails, and sea.</p>
<p><span id="more-96"></span><br />
While most people are blissfully ignorant of what signs like these on a side of a truck mean, I have learned that the code identifies the specific commodity that is hazardous on the truck.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/08/rowid-varchar12-1bd9ef0e-d877-450a-a511-6733c147a931.jpg" alt="1BD9EF0E-D877-450A-A511-6733C147A931.jpg" border="0" width="120" height="114" /></p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/08/rowid-varchar12-79cb0f05-7a97-4d33-acca-5ecfb0c88b83.jpg" alt="79CB0F05-7A97-4D33-ACCA-5ECFB0C88B83.jpg" border="0" width="100" height="98" /></p>
<p>I do a lot of cross country driving and a tool I&#8217;ve always wanted for my iPhone is a HazMat lookup guide, so I can find out what trucks are carrying.  A program like this also has uses not just for the curious like me, but also for people in the industry who work with these hazardous materials, and first responders.</p>
<p>So with that in mind, shortly after the SDK, as a part time diversion, I wrote <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=288696250&#038;mt=8">HazMat</a> for the iPhone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/08/30/hazmat-my-first-published-iphone-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ten tips for Xcode</title>
		<link>http://www.karlkraft.com/index.php/2008/07/18/ten-tips-for-xcode/</link>
		<comments>http://www.karlkraft.com/index.php/2008/07/18/ten-tips-for-xcode/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 16:34:37 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=93</guid>
		<description><![CDATA[Ten quick tips to get a more pleasant experience in Xcode.]]></description>
			<content:encoded><![CDATA[<p>A few minutes ago I was watching someone in IRC try to figure out how to do something and I came to the realization that while they were really bright, the new Xcode environment was so foreign to them they didn&#8217;t really know where to look to find information.</p>
<p>With that in mind I offer these quick tips:</p>
<p><span id="more-93"></span></p>
<h3>1. Xcode comes with all the documentation for pretty much everything you need to write code for Mac OSX and Mobile OSX.<br />
</h3>
<p>  It is hidden under the Help menu, which 99% of OSX apps have, and is ignored by every OSX user, because only 1-2% of them actually have any useful help in them.</p>
<p> <img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz001.jpg" alt="XcodeScreenSnapz001.jpg" border="0" width="364" height="255" /><br />
The documentation is vast.  I hesitate to guess that printed it would be 20-30 feet across on a shelf.  That leads to hint #2</p>
<p></p>
<h3>2.  You can hold down the option key and double click any function or method and jump immediately to the matching documentation.  </h3>
<p>For instance if I option double click on NSLog in this code fragment.<br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz002.jpg" alt="XcodeScreenSnapz002.jpg" border="0" width="380" height="63" /><br />
This comes up in the documentation window.  Notices that NSLogv is a hyperlink to the documentation on that function.<br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz003.jpg" alt="XcodeScreenSnapz003.jpg" border="0" width="416" height="323" /></p>
<p></p>
<h3>3. If you are the kind of person that find a quicker answer in header files, cmd-double click to go to the header file that defines the function or method.  </h3>
<p>This also works with your source code as well.    If you have a method called  doTheThing: and you can&#8217;t remember if it takes a string or int as you are typing code to call dotheThing, just command double click and you will go to the method in your code.  You can then go back to where you came from with the Go back short cut, Command option left. </p>
<p></p>
<h3>4.There are a ton of keyboard shortcuts, and you can change them.</h3>
<p>You can find most of them in the xcode preferences panel under KeyBindings.  A lot of them are based on emacs key bindings.  </p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz004.jpg" alt="XcodeScreenSnapz004.jpg" border="0" width="74" height="63" /></p>
<p>With just 20 or 30 key bindings you can pretty much navigate your entire project, build, run, and test without ever taking your hands off the keyboard.</p>
<p></p>
<h3>5.  While debugging you can hover over a variable to see the value.</h3>
<p>Here you can see I&#8217;ve set a break point on line 175 (the blue marker), and that the program has stopped there (the red arrow indicating the current program counter).    By just placing the mouse over favorites and waiting for a second, I&#8217;m treated to the information that it is supposed to be a NSMutableArray called favorites, and that it is currently a nil pointer and therefore has zero objects.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz006.jpg" alt="XcodeScreenSnapz006.jpg" border="0" width="865" height="138" />xxxxxxxxxxxxxxx</p>
<p>The second time through I find that it has now been created, is actually a NSCFArray, and has seven objects.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz007.jpg" alt="XcodeScreenSnapz007.jpg" border="0" width="865" height="138" /></p>
<p></p>
<h3>6. Xcode is based on standard open source tools</h3>
<p>Under the hood Xcode uses GCC for most compiles, and GDB for the debugging.  So if you know or can find a book about gdb or gcc or a web site about them you will be able to do amazing and clever things.  On top of that advanced features used for performance tracing use dtrace, also open source and also with a large support community.  </p>
<p>This also means when you find a problem in Xcode, you can go down to the command line and duplicate or work around the problem.  For instance I have an executable that Xcode never will play nicely with when I&#8217;m debugging.  So I can debug the same app from the command line using GDB.</p>
<p></p>
<h3>7. Research Assistant</h3>
<p>Research Assistant is not as well polished as other parts of Xcode because it is relatively new.  Like the documentation, you find it under the help menu.  Leave it open and as you type it will show a quick documentation snippet for the code to the left of the insertion point.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz0021.jpg" alt="XcodeScreenSnapz002.jpg" border="0" width="259" height="80" /></p>
<p>It updates live as you type, showing not only the arguments, but also providing hyper links to them, and showing sample code that uses the class, function or method:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz0011.jpg" alt="XcodeScreenSnapz001.jpg" border="0" width="323" height="642" /></p>
<p>I find it a bit too slow updating and unreliable for my tastes, but for a beginner it can be very useful.</p>
<p></p>
<h3>8. You can move things around in condensed mode</h3>
<p>I tend to run Xcode in condensed mode and found myself getting pretty frustrated having to move between Files, Targets and Other.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz0031.jpg" alt="XcodeScreenSnapz003.jpg" border="0" width="320" height="318" /><br />
<img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz0041.jpg" alt="XcodeScreenSnapz004.jpg" border="0" width="320" height="318" /></p>
<p>Quite by accident I discovered that you can move things between them.  To switch sections while dragging just drag over the tab:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz005.jpg" alt="XcodeScreenSnapz005.jpg" border="0" width="320" height="318" /></p>
<p>You can use the same trick to drag files from the project to  particular build phase of a target using this method as well.</p>
<p></p>
<h3>9. Code Completion on demand</h3>
<p>One developer I worked with thought the only way to get code completion to work was the settings in the Code Sense pane of the preferences tab.  He was constantly tweaking the delay setting up and down depending on the code he was working on. </p>
<p>If you need code completion NOW, and don&#8217;t want to wait the 2-3 seconds for the popup, you can use these key bindings:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-xcodescreensnapz0061.jpg" alt="XcodeScreenSnapz006.jpg" border="0" width="424" height="80" /></p>
<h3>10. [Withheld]</h3>
<p>I had a tenth tip, but I didn&#8217;t think it all that great. So I have withheld it for a future post.  In the mean time, <a href="mailto:karl@karlkraft.com?Subject=Xcode%20Tips">send me any more tips<a/> you have and I&#8217;ll collect them and post the best. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/07/18/ten-tips-for-xcode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Epocrates RX and background network chatter</title>
		<link>http://www.karlkraft.com/index.php/2008/07/14/yes-epocrates-rx-does-run-in-the-background-and-here-is-how/</link>
		<comments>http://www.karlkraft.com/index.php/2008/07/14/yes-epocrates-rx-does-run-in-the-background-and-here-is-how/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 18:23:24 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=80</guid>
		<description><![CDATA[The secret key to being able to keep a network connection when you quit.]]></description>
			<content:encoded><![CDATA[<p>Update: I got a note from one of the developers at Epocrates.</p>
<p>He provided a detailed response about Epocrates use of the flag and assured me that he was in the same boat as all of us, waiting for some way to run in the background, and not able to do it yet.   </p>
<p>So a quick shout out to Epocrates for the information.</p>
<hr />
<p>Using the information in my <a href="http://www.karlkraft.com/index.php/2008/07/14/where-are-the-downloaded-iphone-applications-and-what-format-are-they-in/"> previous post </a>, I was able to find out how Epocrates keeps an open network connection.  No idea why they do it, but I know how it is done.<br />
<span id="more-80"></span></p>
<p>The secret lies in a special key inside the Info.plist file. Both Remote and Epocrates Rx have this in common:</p>
<p>If you look in the Info.plist file you will find a key with the name UIRequiresPersistentWiFi.  I haven&#8217;t been able to find any documentation for this setting, but it does seem like an aptly named obvious choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/07/14/yes-epocrates-rx-does-run-in-the-background-and-here-is-how/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where are the downloaded iPhone applications, and what format are they in?</title>
		<link>http://www.karlkraft.com/index.php/2008/07/14/where-are-the-downloaded-iphone-applications-and-what-format-are-they-in/</link>
		<comments>http://www.karlkraft.com/index.php/2008/07/14/where-are-the-downloaded-iphone-applications-and-what-format-are-they-in/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 18:17:20 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=79</guid>
		<description><![CDATA[About iPhone application file format (ipa), and how to extract resources from them]]></description>
			<content:encoded><![CDATA[<p>During the last 4 months Apple has been pretty tight lipped about just about everything involving the App Store.  So I&#8217;ve done my best to guess how things will end up.  One thing I guessed wrong about is that applications would be encrypted.  They arent.<br />
<span id="more-79"></span><br />
If the apps had been encrypted it would have made it more difficult for people to get access to the raw data that the application uses.</p>
<p>Applications downloaded from the App Store are stored inside your Music folder as ipa files.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/finderscreensnapz001.jpg" alt="FinderScreenSnapz001.jpg" border="0" width="536" height="27" /></p>
<p>Inside that folder is an ipa file for each application you have downloaded.</p>
<p>But ipa files are really just zip files.  Lets pull apart Super Monkey Ball as an example:</p>
<p>First, work on a copy of the ipa file.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/finderscreensnapz004.jpg" alt="FinderScreenSnapz004.jpg" border="0" width="178" height="95" /></p>
<p>Rename from ipa to zip</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-finderscreensnapz005.jpg" alt="FinderScreenSnapz005.jpg" border="0" width="178" height="95" /></p>
<p>Double click to unzip, and you find a folder with 3 items inside:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-finderscreensnapz006.jpg" alt="FinderScreenSnapz006.jpg" border="0" width="506" height="138" /></p>
<p>iTunesArtwork is a jpeg format image that contains the application icon.</p>
<p>iTunesMetaData provides information on who bought the applcation, what version it is, when it was bought and other useful meta data about the application.</p>
<p>The folder Payload contains the actual iPhone application.  By using the contextual menu you can go further inside the application.</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-finderscreensnapz007.jpg" alt="FinderScreenSnapz007.jpg" border="0" width="364" height="112" /></p>
<p>You may notice that most of the png files show up as a question mark in Preview:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-marseditscreensnapz001.jpg" alt="MarsEditScreenSnapz001.jpg" border="0" width="384" height="224" /></p>
<p>This is because they are in a special iPhone format designed to make them more compact.  You can use fixpng to undo the compaction. Sometimes the colors will be off:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/rowid-varchar12-default-out.png" alt="Default-out.png" border="0" width="320" height="480" /></p>
<p>And there you go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/07/14/where-are-the-downloaded-iphone-applications-and-what-format-are-they-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How much is that application</title>
		<link>http://www.karlkraft.com/index.php/2008/07/11/how-much-is-that-application/</link>
		<comments>http://www.karlkraft.com/index.php/2008/07/11/how-much-is-that-application/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 11:33:00 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=70</guid>
		<description><![CDATA[Bugs in the App Store]]></description>
			<content:encoded><![CDATA[<p>While browsing the app store I came across this quirk in pricing.</p>
<p><span id="more-70"></span></p>
<p>On the list of top 25 apps the cost is $0.99:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/1buck-yp.png" alt="1buck_yp.png" border="0" width="320" height="480" /></p>
<p>But on the detail page the application is free:</p>
<p><img src="http://www.karlkraft.com/wp-content/uploads/2008/07/free-yp.png" alt="free_yp.png" border="0" width="320" height="480" /></p>
<p>If I was an iPhone developer and found my app being given away for free I would be a bit miffed.</p>
<p>If I was an iPhone user, and found that it was ther other direction (free on the list, cost in the detail), I would be equally miffed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/07/11/how-much-is-that-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does Epocrates run in the background?</title>
		<link>http://www.karlkraft.com/index.php/2008/07/10/does-epocrates-run-in-the-background/</link>
		<comments>http://www.karlkraft.com/index.php/2008/07/10/does-epocrates-run-in-the-background/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 04:17:57 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=67</guid>
		<description><![CDATA[Epocrates Rx for the iPhone appears to be a special app that gets to run in the background.]]></description>
			<content:encoded><![CDATA[<p>While playing around with the final 2.0 I noticed that lots of apps appear to be doing network activity that don&#8217;t really have a network component, so I fired up a packet sniffer, dropped the phone into Airplane mode, and then enabled the wireless to force all network traffic out a router that I could sniff.</p>
<p>Some interesting surprises about Epocrates Rx.</p>
<p><span id="more-67"></span></p>
<p>The first is that during startup it sends your firmware revision, device name and device ID to their servers.  Not sure they could do much with that, and I think they are probably just trying to gather statistics.</p>
<p>The second though is that some component of the software continues to run in the background after you have quit the app.</p>
<p>A few seconds after quitting I noticed this traffic:</p>
<p>20:20:36.744796 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806</p>
<p>At first I though it was just a stray packet still making its way out the wire after I quit.  But during the testing of the next app the traffic continued.  About once a minute some program was trying to connect to http://63.241.66.151/</p>
<p>20:21:08.786246 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:22:12.873043 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:23:16.960316 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:24:21.048086 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:25:25.129605 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:26:29.211306 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:27:33.293013 IP 10.10.10.248.49400 > 63.241.66.151.http: F 215:215(0) ack 24179 win 32806<br />
20:28:37.374242 IP 10.10.10.248.49400 > 63.241.66.151.http: R 216:216(0) ack 24179 win 32806</p>
<p>A quick nslookup returns:</p>
<p>%nslookup 63.241.66.151</p>
<p>151.66.241.63.in-addr.arpa	canonical name = 151.epocrates.com.<br />
151.epocrates.com	name = honors.epocrates.com.</p>
<p>Is this proof that an app can communicate after it terminates?  Or just a quirk of the iPhone OS?</p>
<p>&#8211; Added 7/14&#8211;</p>
<p>Followup: Looks like it isn&#8217;t an artifact of the OS but an intentional <a href="http://www.karlkraft.com/index.php/2008/07/14/yes-epocrates-rx-does-run-in-the-background-and-here-is-how/#more-80">setting that allows apps to keep network connections open in the background.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2008/07/10/does-epocrates-run-in-the-background/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
