<?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>TouchCentric &#187; iphone</title>
	<atom:link href="http://www.touchcentric.com/blog/archives/tag/iphone/feed" rel="self" type="application/rss+xml" />
	<link>http://www.touchcentric.com/blog</link>
	<description>iPhone-centric stuff we're thinking about</description>
	<lastBuildDate>Wed, 25 Aug 2010 17:09:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>App Store Rank for Many Apps</title>
		<link>http://www.touchcentric.com/blog/archives/42</link>
		<comments>http://www.touchcentric.com/blog/archives/42#comments</comments>
		<pubDate>Tue, 26 May 2009 17:57:01 +0000</pubDate>
		<dc:creator>Rob Terrell</dc:creator>
				<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphonedev]]></category>
		<category><![CDATA[rank]]></category>

		<guid isPermaLink="false">http://www.touchcentric.com/blog/?p=42</guid>
		<description><![CDATA[If you have more than a few apps in the App Store, keeping track of the rank of your apps can become a chore. Currently there are 21 apps in the store that I've developed, and for marketing (and, sure, ego) reasons I'd like to know how they are doing. But not at the expense of a lot of time.

The goal here was to have a single, flexible script to handle all of the possible app ranking cases. And specifically, I wanted a script I could call from AppleScript, which would place the results into a spreadsheet, without lots of text parsing in AppleScript (because text parsing is tedious in AppleScript, although to be fair, everything is tedious in AppleScript.)]]></description>
			<content:encoded><![CDATA[<p>If you have more than a few apps in the App Store, keeping track of the rank of your apps can become a chore. There&#8217;s over a dozen apps in the store that I&#8217;ve developed, and for marketing (and, sure, ego) reasons I&#8217;d like to know how they are doing. But I&#8217;m busy. And laaazy. I wanted a script to do it for me.</p>
<p>The goal was to have a single, flexible script. And specifically, I wanted something I could call from an AppleScript, which would place the results into a spreadsheet without lots of text parsing in AppleScript (because text parsing is tedious in AppleScript, although to be fair, everything is tedious in AppleScript.)</p>
<p>The script I came up with is mostly <a href="http://benchatelain.com/2009/03/05/scraping-app-store-rankings-around-the-world/">Ben Chatelain&#8217;s excellent perl script</a> (again based on the work of Erica Sadun). To better fit my workflow, I modified Ben&#8217;s script in the following ways:</p>
<ul>
<li>Accepts the app ID, category, &#8220;free&#8221; or &#8220;paid&#8221;, and country name as arguments the command line.</li>
<li>Returns just a number (the app&#8217;s rank in the given category), or &#8220;n/a&#8221; if it&#8217;s not ranked in the top 100 for that category/country combination.</li>
<li>Arguments (except app ID) are optional &#8212; the script will assume &#8220;Top Overall&#8221;, &#8220;United States&#8221;, and &#8220;free&#8221;.)</li>
<li>The script will cache the most recent data (and curl is invoked with -z). This way, if you call the script a dozen times in a row, it only pulls the page once, and the rest of the invocations use the cached data (stored in /tmp).</li>
<li>To check the &#8220;Top Apps&#8221; overall rankings, pass in &#8220;Top Overall&#8221; for the category name.</li>
<li>Likewise, to see the ranking for every country in the world, pass in &#8220;world&#8221; for country. The script will check the top apps for every country. In this case, the returned results are a string of &#8220;countryName: rank\n&#8221;, one per country.</li>
</ul>
<p>You call it from the command line like this:</p>
<pre>app_rank.pl appID categoryName free|paid countryName</pre>
<pre>rob$ app_rank.pl 300872165 News free
37</pre>
<p>Or to see the results for the whole world (results edited for blog brevity):</p>
<pre>rob$ app_rank.pl 300872165 News free world
Lebanon: 47
Saudi Arabia: 73
Pakistan: 74
Mexico: 71
Colombia: 61
Hungary: 89
Croatia: 19
...et cetera...</pre>
<p>(How is my english-language not-localized North-Carolina-specific app #19 in Croatia?!?)</p>
<p>Here&#8217;s the AppleScript I use to populate a spreadsheet:</p>
<div id="attachment_43" class="wp-caption alignnone" style="width: 494px"><img class="size-full wp-image-43" title="AppleScript for App Rank" src="http://www.touchcentric.com/blog/wp-content/uploads/2009/05/apprankingscript.jpg" alt="AppleScript to get the app rank and put it into Numbers" width="484" height="457" /><p class="wp-caption-text">AppleScript to get the app rank and put it into Numbers</p></div>
<p>Here&#8217;s the spreadsheet it fills out. The AppleScript pulls the appID to look up from the first cell in each column, and then adds the timestamp and the app&#8217;s rank, so I can add new app IDs as I get them.</p>
<div id="attachment_44" class="wp-caption alignnone" style="width: 587px"><img class="size-full wp-image-44" title="App rank data in Numbers" src="http://www.touchcentric.com/blog/wp-content/uploads/2009/05/apprankingnumbers.jpg" alt="App rank data in Numbers" width="577" height="209" /><p class="wp-caption-text">App rank data in Numbers</p></div>
<p>I scheduled the script to run every few hours (using Ligon) and so I&#8217;m slowly accumulating data. Of course, I can never sleep my laptop or I&#8217;ll miss some data. This concept would probably be best realized as something that runs on a server via cron. Since it&#8217;s a perl script that uses curl instead of some CPAN package it&#8217;s probably easily portable to just about anywhere. It would be simple to move this script to a server and collect the data in some other fashion.</p>
<p>Note that you can also use this same technique to track your app&#8217;s success against competing apps.</p>
<p>The <a onclick="javascript: pageTracker._trackPageview('http://touchcentric.com/clients/app_rank.zip'); " href="http://touchcentric.com/clients/app_rank.zip">script is here</a> (3k zipped perl script).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touchcentric.com/blog/archives/42/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone App Video Mirroring</title>
		<link>http://www.touchcentric.com/blog/archives/3</link>
		<comments>http://www.touchcentric.com/blog/archives/3#comments</comments>
		<pubDate>Fri, 15 May 2009 20:51:08 +0000</pubDate>
		<dc:creator>Rob Terrell</dc:creator>
				<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphonesdk]]></category>
		<category><![CDATA[mptvoutwindow]]></category>

		<guid isPermaLink="false">http://www.touchcentric.com/blog/?p=3</guid>
		<description><![CDATA[<p>How can you show your app to a large group? What if you want to show an app to a client, an investor, or at a trade show? Extensive Googling reveals lots of people asking the question, but no good answer. </p>
<p>I'm the organizer of the <a href="http://www.meetup.com/iPhone-Developers/">Raleigh iPhone Developer's Meetup</a> and it's basically impossible for our group's members to demo their apps. The "crowd people around a phone" method breaks at around four people. And our last meetup had 20 people!</p>
<p>Why can't we be like Steve, using our apps on our phone, with the display projected for all to see?</p>
<img class="size-full wp-image-28" title="iPhone App Video Output" src="http://www.touchcentric.com/blog/wp-content/uploads/2009/05/tvout1.jpg" alt="iPhone app displaying its output on a TV" width="500" />
<p>I have a solution, if you're willing to make a special build of your app that's not meant for the app store. No jailbreaking required! Although a willingness to use private methods is.</p>]]></description>
			<content:encoded><![CDATA[<p>How can you show your app to a large group? What if you want to show an app to a client, an investor, or at a trade show? Extensive Googling reveals lots of people asking the question, but no good answer.</p>
<p>I&#8217;m the organizer of the <a href="http://www.meetup.com/iPhone-Developers/">Raleigh iPhone Developer&#8217;s Meetup</a> and it&#8217;s basically impossible for our group&#8217;s members to demo their apps. The &#8220;crowd people around a phone&#8221; method breaks at around four people. And our last meetup had 20 people!</p>
<p>Why can&#8217;t we be like Steve, using our apps on our phone, with the display projected for all to see?</p>
<p>I have a solution, if you&#8217;re willing to make a special build of your app that&#8217;s not meant for the app store. No jailbreaking required! Although a willingness to use private methods is.</p>
<p><b>Update:</b> There&#8217;s a new version for iOS 4.0 here: <a href="http://www.touchcentric.com/blog/archives/123">http://www.touchcentric.com/blog/archives/123</a></p>
<p><strong>How It Works</strong></p>
<p>Inside the iPhone SDK exists a private API for video output. A class called MPTVOutWindow will display whatever it contains via the video output dock connector. (Thanks to Erica Sadun who discovered this class and figured out how to use it!)</p>
<p>I created a UIApplication category (that is to say, an extension to the existing UIApplication class) that uses MPTVOutWindow to mirror the device display onto the TV display. The goal was to make it seamless &#8212; drop the file into a project, recompile, and go. And it&#8217;s really just that easy, with a couple of caveats.</p>
<p>Caveat #1: apps that use this won&#8217;t be allowed into the App Store. That&#8217;s because it uses a couple of private APIs (the MPTVOutWindow class and UIGetScreenImage()). But since you&#8217;re already an iPhone application developer, creating a private build for your own use is normal.</p>
<p><span style="text-decoration: line-through;">Caveat #2: it doesn&#8217;t copy parts of the screen that belong to OpenGL. The class could be extended to do that, if you needed to.</span></p>
<p>Update: actually, it works fine with OpenGL. I demoed an OpenGL game using this at about 20 fps.</p>
<p><strong>Getting Started</strong></p>
<p>First, get a video out cable. It&#8217;s the same cable you&#8217;d use to watch videos from your iPhone on a TV using the dock connector (note: headphone-jack video cables from older iPods do not work). Apple&#8217;s official cable, <a href="http://store.apple.com/us/product/MB128LL/B?fnode=MTY1NDAzOQ&amp;mco=MjE1NTI2OA">Apple Component AV Cable</a>, is $50 for composite video. A similar cable is only $14.18 at <a href="http://www.monoprice.com/products/product.asp?c_id=108&amp;cp_id=10831&amp;cs_id=1083105&amp;p_id=4825&amp;seq=1&amp;format=2">MonoPrice.com</a>. Component cables are also available.<span style="white-space: pre;"> </span>`</p>
<p><strong>How To Use</strong></p>
<p>Add the file UIApplication+TVOut.m to your project. Also, you&#8217;ll need the &#8220;MediaPlayer.framework&#8221; framework, which contains references to the private API we&#8217;re using.</p>
<p>Somewhere in your code you need to call start. Anytime <strong>after </strong>your app&#8217;s primary window has been created, call startTVOut:</p>
<div>
<pre><code>     [[UIApplication] sharedApplication] startTVOut];
</code></pre>
</div>
<p>That&#8217;s about all you need to do. The application category handles everything necessary to mirror the device&#8217;s display. The startTVOut method creates the MPTVoutWindow, adds the necessary subviews, rotates them to match your app&#8217;s orientation, and centers them to appear properly on the TV. A background thread copies the bits from your main display into a view in the MPTVOutWindow. (You can configure the frames per second in the #define at the top of the file. 12 fps works well for me.)</p>
<div id="attachment_28" class="wp-caption alignnone" style="width: 624px"><img class="size-full wp-image-28 " title="iPhone App Video Output" src="http://www.touchcentric.com/blog/wp-content/uploads/2009/05/tvout1.jpg" alt="iPhone app displaying its output on a TV" width="614" height="461" /><p class="wp-caption-text">iPhone app displaying its output on a TV</p></div>
<p>In my test app, I call it from applicationDidFinishLaunching:. One thing to remember about applicationDidFinishLaunching: is that it gets called before the runloop starts, so your primary window isn&#8217;t on screen yet. I call it with a brief delay to give the runloop a chance to get going.</p>
<pre><code>- (void)applicationDidFinishLaunching:(UIApplication*)application {<span>	</span>
// give the runloop a chance to start
    [[UIApplication sharedApplication] performSelector: @selector(startTVOut)
    withObject: nil afterDelay: .1];
}</code></pre>
<p>And actually, you don&#8217;t even need to call startTVOut. The category can start itself. The code includes an override for a private method called reportAppLaunchFinished:. This undocumented method seems to get called after the app has finished loading. (Being undocumented, I&#8217;m not really sure what it does, or what the negative consequences of overriding it has. As far as I can tell, it&#8217;s only used to clean up the Default.png display.) I&#8217;ve commented out that method, since it&#8217;s a bit mysterious. But if you uncomment the method, it will automatically start the TV out display for you. No changes to your code needed!</p>
<p><strong>Mirroring Other Apps?</strong></p>
<p>Since this code runs as part of your app, it stops running when your app stops running. So it&#8217;s not a general purpose full-time video mirroring solution.</p>
<p>However, using other private methods, it&#8217;s possible to launch other apps while your app remains running, thus mirroring whatever app is in front. I&#8217;ve managed to mirror Safari (launched using the private openURL:asPanel: method). I&#8217;m sure you can figure ways to mirror other apps using some of the private app launching methods.</p>
<p><strong>Not for Public Consumption!</strong></p>
<p>Since this uses private methods, it would almost certainly not survive Apple&#8217;s app review process. To avoid getting your app rejected, you should remove this code from your release builds. This is pretty easy &#8212; set the current target to Release and uncheck the checkbox next to the file&#8217;s name. Also, if you call startTVOut manually, you&#8217;ll need to put some #ifdefs around that call, so it won&#8217;t get compiled into release builds.</p>
<p><strong>Great, Where&#8217;s the Code?</strong></p>
<p>Grab the latest code from here:</p>
<p><a onclick="javascript: pageTracker._trackPageview('http://groups.google.com/group/iphone-developers-nc/web/UIApplication_TVOut.m');" href="http://groups.google.com/group/iphone-developers-nc/web/UIApplication_TVOut.m">http://groups.google.com/group/iphone-developers-nc/web/UIApplication_TVOut.m</a></p>
<p>If you have any comments or questions, feel free to email me.</p>
<p>&#8211; Rob</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touchcentric.com/blog/archives/3/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
