<?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>Arash Payan &#124; Blog &#187; iPhone</title>
	<atom:link href="http://arashpayan.com/blog/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://arashpayan.com/blog</link>
	<description>(Place witty tagline here)</description>
	<lastBuildDate>Thu, 22 Sep 2011 06:43:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Presenting, Appirater</title>
		<link>http://arashpayan.com/blog/2009/09/07/presenting-appirater/</link>
		<comments>http://arashpayan.com/blog/2009/09/07/presenting-appirater/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 00:16:00 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[appirater]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=172</guid>
		<description><![CDATA[Like most developers, I&#8217;m not thrilled with the way the App Store presents my apps. There are several problems, but in particular, I really don&#8217;t like the user review system. It&#8217;s biased towards bad reviews, and that ends up hurting sales (there are odd exceptions to this). The only time a user is reminded or [...]]]></description>
			<content:encoded><![CDATA[<p>Like most developers, I&#8217;m not thrilled with the way the App Store presents my apps. There are several problems, but in particular, I really don&#8217;t like the user review system. It&#8217;s biased towards bad reviews, and that ends up hurting sales (there are odd exceptions to this). The only time a user is reminded or asked to rate an app is when you delete it, and you probably don&#8217;t care for the app if you&#8217;re deleting it. In comparison to the unhappy user, the satisfied user rarely takes the time to review your app. Which leaves you with crummy reviews from uninformed users hurting sales of your app.</p>
<p>If Apple would allow developers to respond to reviews, or more easily challenge the validity of a review, this would be no big deal. But I don&#8217;t have any hopes of Apple wising up and fixing anything, so I&#8217;m left trying to get more positive reviews of my apps to drown out the negatives ones.</p>
<p><strong>Appirater</strong><br />
The goal of Appirater is to encourage your satisfied user&#8217;s to rate your app. To use it, place the <a href="http://github.com/arashpayan/appirater/">Appirater code</a> into your project, and add the following code in your app&#8217;s delegate class.</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#236e25;">// import the Appirater class<br />
</span><span style="color:#683821;">#import &quot;Appirater.h&quot;<br />
</span><br />
<span style="color:#881350;">@implementation</span> MyAppDelegate</p>
<p>- (<span style="color:#881350;">BOOL</span>)<span style="color:#6c0540;">application:</span>(<span style="color:#400080;">UIApplication</span> *)application <span style="color:#6c0540;">didFinishLaunchingWithOptions:</span>(<span style="color:#400080;">NSDictionary</span> *)launchOptions {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// all your app&#8217;s startup code<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// &#8230;<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// call the Appirater class<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;[Appirater <span style="color:#6c0540;">appLaunched</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">return</span> <span style="color:#881350;">YES</span>;<br />
}</p>
<p><span style="color:#881350;">@end</span></div>
<p><br/><br />
Finally, open up <code>Appirater.h</code> and change the <code>APPIRATER_APP_ID</code> to your apps software id. You can also change the other <code>#define</code>s, for a more customized reminder message and buttons, but the default should suffice for most apps.</p>
<p>Now every time the user launches your app, Appirater will see if they&#8217;ve used the app for 30 days and launched it at least 15 times. If they have, they&#8217;ll be asked to rate the app, and then be taken to your app&#8217;s review page in the App Store. If you release a new version of your app, Appirater will again wait until the new version has been used 15 times for 30 days and then prompt the user again for another review. Optionally, you can adjust the days to wait and the launch number by changing <code>DAYS_UNTIL_PROMPT</code> and <code>LAUNCHES_UNTIL_PROMPT</code> in <code>Appirater.h</code>.</p>
<p><img src="http://arashpayan.com/blog/wp-content/uploads/2009/09/AppiraterScreenshot.png" alt="Appirater as used in Prayer Book app" title="Appirater as used in Prayer Book app" width="320" height="480" class="aligncenter size-full wp-image-188" /></p>
<p>Code: <a href="http://github.com/arashpayan/appirater/">http://github.com/arashpayan/appirater/</a></p>
<p>BTW, if you like Appirater, please consider checking out my game, <a href="http://itunes.com/app/Jabeh">Jabeh</a> or the <a href="http://itunes.com/app/JabehLite">lite version</a> of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/09/07/presenting-appirater/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Cheap iPhone data plan with T-Mobile USA</title>
		<link>http://arashpayan.com/blog/2009/08/25/cheap-iphone-data-plan-with-t-mobile-usa/</link>
		<comments>http://arashpayan.com/blog/2009/08/25/cheap-iphone-data-plan-with-t-mobile-usa/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 23:20:18 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[data plan]]></category>
		<category><![CDATA[tmobile]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=163</guid>
		<description><![CDATA[Just a quick post for everyone who&#8217;s lucky enough to be using T-Mobile on their iPhone in the US. It&#8217;s possible to get a data plan for your iPhone at only $9.99. It&#8217;s edge only, but that doesn&#8217;t matter because T-Mobile&#8217;s 3G network is incompatible with the iPhone&#8217;s 3G radio. Here it is: Log into [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post for everyone who&#8217;s lucky enough to be using T-Mobile on their iPhone in the US. It&#8217;s possible to get a data plan for your iPhone at only $9.99. It&#8217;s edge only, but that doesn&#8217;t matter because T-Mobile&#8217;s 3G network is incompatible with the iPhone&#8217;s 3G radio.</p>
<p>Here it is:</p>
<ol>
<li>Log into your account at tmobile.com. Change your device to be a silver (the pink one won&#8217;t work!) Motorola RAZR.</li>
<li> As of this writing, there&#8217;s a bug in the site that prevents you from seeing the correct data plans for your newly selected device, so log out of the site, then log back in again. Now fFind your way to the page that lists the possible services you can add on to your plan, and you should now be able to select a $9.99/month web plan ($20 gets you unlimited texting as well). Select it.</li>
<li>In your iPhone go to <code>Settings->General->Network->Cellular Data Network</code> and for the APN use <code>internet2.voicestream.com</code>. Leave the username and password blank.</li>
</ol>
<p>You might need to wait up to 24 hours for the service to be activated. Just keep restarting your phone periodically and check to see if it starts working.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/08/25/cheap-iphone-data-plan-with-t-mobile-usa/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How To: Get a Video Screen Capture from Your iPhone</title>
		<link>http://arashpayan.com/blog/2009/08/15/how-to-get-a-video-screen-capture-from-your-iphone/</link>
		<comments>http://arashpayan.com/blog/2009/08/15/how-to-get-a-video-screen-capture-from-your-iphone/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 07:24:31 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=152</guid>
		<description><![CDATA[I just setup my iPhone so I can control it remotely and ultimately perform video captures of my activity on it. It&#8217;s a quick and painless process, and here&#8217;s a step by step for those interested: Jailbreak your iPhone/iPod Touch There are various tutorials around that take you through the jailbreaking process. Just make sure [...]]]></description>
			<content:encoded><![CDATA[<p>I just setup my iPhone so I can control it remotely and ultimately perform video captures of my activity on it. It&#8217;s a quick and painless process, and here&#8217;s a step by step for those interested:</p>
<ol>
<li><strong>Jailbreak your iPhone/iPod Touch</strong> There are <a href="http://www.iphonedownloadblog.com/2009/06/19/tutorial-jailbreak-your-iphone-3g-30-with-pwnagetool-for-mac/">various</a> <a href="http://blog.iphoneunlocking.com/2009/07/07/tutorial-jailbreak-iphone-3gs-using-redsn0w/">tutorials</a> around that take you through the jailbreaking process. Just make sure to use the <a href="http://thepiratebay.org/user/iphonedev/">latest version</a> of the jailbreaking tools and install Cydia if you&#8217;re prompted.</li>
<li><strong>Launch Cydia and install Veency</strong> If this is your first time opening up Cydia, you&#8217;ll be prompted about what mode you want the program to run in; select &#8216;User&#8217;. Next click on the <code>Sections</code> tab at the bottom, select the <code>Networking</code> section and scroll down until you see <code>Veency</code>. Select it and press Install.</li>
<li><strong>Download and install a VNC client</strong> If you&#8217;re on OS X,  you can download <a href="http://sourceforge.net/projects/cotvnc/">Chicken of the VNC</a>. On Windows, you can use <a href="http://www.tightvnc.com/">Tight VNC</a>.</li>
<li><strong>Find your iPhone&#8217;s IP address</strong> On your phone go to <code>Settings-&gt;Wi-Fi</code> then click the blue disclosure button for the network you&#8217;re logged into. Take note of your iPhone&#8217;s IP address, because we&#8217;ll need it later. Mine is <code>192.168.1.50</code>.</li>
<li><strong>Launch VNC and connect to your iPhone</strong> Make sure your iPhone is unlocked and logged into your Wi-Fi network. Launch Chicken of the VNC (or Tight VNC) from your desktop, type in your iPhone&#8217;s IP address for the <code>Host</code>, and leave the <code>Display</code> at 0, then hit Connect. You should see a prompt on your iPhone asking you to accept or reject the connection. <img src="http://arashpayan.com/blog/wp-content/uploads/2009/08/Veency_Prompt.PNG" alt="Veency Prompt" title="Veency Prompt" width="320" height="480" class="size-full wp-image-153" /><br/>Go ahead and accept.</li>
<li><strong>Control the iPhone</strong> You can control the iPhone with left-mouse clicks and the keyboard. You can simulate a press of the &#8216;Home&#8217; button with a right-mouse click, and you can simulate the &#8216;Sleep/Power&#8217; button with a middle-mouse click.</li>
<li><strong>Capture the iPhone screen</strong> I like to use <a href="http://www.telestream.net/screen-flow/">Screenflow</a> on my Mac to capture screencasts. I&#8217;m not up to date on the best screen capturing software for Windows, but I&#8217;m sure there are plenty of options out there.</li>
</ol>
<p>A couple caveats: The frame rate&#8217;s not that great, which produces some artifacts during animations, and any app that uses OpenGL doesn&#8217;t work at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/08/15/how-to-get-a-video-screen-capture-from-your-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>t-zones is even easier to setup now</title>
		<link>http://arashpayan.com/blog/2009/05/11/t-zones-is-even-easier-to-setup-now/</link>
		<comments>http://arashpayan.com/blog/2009/05/11/t-zones-is-even-easier-to-setup-now/#comments</comments>
		<pubDate>Tue, 12 May 2009 07:57:35 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[tzones]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=121</guid>
		<description><![CDATA[After restoring a family member&#8217;s iPhone that was acting up, I began setting up t-zones for them, but couldn&#8217;t find the t-zones hack in the BigBoss repository. After some experimenting, I soon realized that none of the proxy configuration work is required anymore either. Setting up t-zones on your iPhone is now an easy 3 [...]]]></description>
			<content:encoded><![CDATA[<p>After restoring a family member&#8217;s iPhone that was acting up, I began setting up t-zones for them, but couldn&#8217;t find the t-zones hack in the BigBoss repository. After some experimenting, I soon realized that none of the proxy configuration work is required anymore either. Setting up t-zones on your iPhone is now an easy 3 step process:</p>
<ol>
<li>Go to <code>Settings->General->Network->Cellular Data Network</code>
<li>Type <code>wap.voicestream.com</code> for the APN (leave the username and password) blank
<li>There&#8217;s no step 3!
</ol>
<p>That&#8217;s all there is to it. YouTube even works over t-zones now.</p>
<p>BTW, if you&#8217;re a long time T-Mobile customer, you can call in right now and ask about the loyal customer plan. If you&#8217;ve been with them long enough, you can have a plan which gives you unlimited minutes for only $50 a month.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/05/11/t-zones-is-even-easier-to-setup-now/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Jabeh: Puzzle Game for iPhone and iPod Touch</title>
		<link>http://arashpayan.com/blog/2009/02/25/jabeh-puzzle-game-for-iphone-and-ipod-touch/</link>
		<comments>http://arashpayan.com/blog/2009/02/25/jabeh-puzzle-game-for-iphone-and-ipod-touch/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 01:30:14 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[jabeh]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=93</guid>
		<description><![CDATA[The project that I&#8217;ve been working on for the past couple months has finally come to fruition, and is available for purchase on the iTunes App Store. Jabeh is a puzzle game where you search for 12 hidden stones on a board. Arrows on the board point in the direction of one or more stones, [...]]]></description>
			<content:encoded><![CDATA[<p>The project that I&#8217;ve been working on for the past couple months has finally come to fruition, and is available for purchase on the iTunes App Store.</p>
<p><a href="http://jabeh.org">Jabeh</a> is a puzzle game where you search for 12 hidden stones on a board. Arrows on the board point in the direction of one or more stones, and the column and row numbers show how many stones are in the respective column and row. Using deduction you can figure out where the stones can&#8217;t be in order to ultimately find out where all 12 stones are. While you&#8217;re playing the game, some light music plays in the background (which you can download for free from the <a href="http://jabeh.org">Jabeh website</a>), and when you solve the puzzle you&#8217;re rewarded with one of the beautiful pieces of art created exclusively for Jabeh.</p>
<p>You can get <a href="http://itunes.com/app/Jabeh">Jabeh</a> now for $4.99 or download <a href="http://itunes.com/app/JabehLite">Jabeh Lite</a> for free if you wanna try before you buy.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/02/25/jabeh-puzzle-game-for-iphone-and-ipod-touch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On App Store Download Statistics</title>
		<link>http://arashpayan.com/blog/2009/01/15/on-app-store-download-statistics/</link>
		<comments>http://arashpayan.com/blog/2009/01/15/on-app-store-download-statistics/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 10:31:05 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[Prayer Book]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=76</guid>
		<description><![CDATA[It seems that nobody wants to release statistics about how their apps are doing on the iTunes App Store, yet a lot of people want to know how well various apps are doing. I&#8217;ve seen a couple of examples of income and download numbers, but I&#8217;d still like to see more. So, I&#8217;m putting my [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that nobody wants to release statistics about how their apps are doing on the <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewGenre?id=36&#038;mt=8">iTunes App Store</a>, yet a lot of people want to know how well various apps are doing. I&#8217;ve seen <a href="http://www.taptaptap.com/blog/final-numbers-for-july/">a</a> <a href="http://www.taptaptap.com/blog/the-easy-way-to-get-into-the-iphone-app-game-buy-a-proven-app/">couple</a> <a href="http://venturebeat.com/2008/12/27/a-christmas-ifart-explosion-nearly-40000-downloads-and-30000-net/">of</a> <a href="http://blog.wired.com/gadgets/2008/09/indie-developer.html">examples</a> of income and download numbers, but I&#8217;d still like to see more. So, I&#8217;m putting my money where my mouth is and publishing the download statistics for my first app, <a href="http://itunes.com/app/PrayerBook">Prayer Book</a>.</p>
<p>For some background about the app, you may want to check out my <a href="http://arashpayan.com/blog/2008/10/02/prayer-book-for-iphone-and-ipod-touch/">earlier post</a>. After submitting Prayer Book to Apple on September 24th, they approved it for sale on October 2nd. It was immediately placed on the App Store, but it was never at the top of the recently released apps list, because I had set the release date to be September 24th. It wasn&#8217;t until 3 months later that I learned that your order in the App Store has nothing to do with the date Apple approves your app.</p>
<p><img src="http://arashpayan.com/blog/wp-content/uploads/2009/01/prayerbookmonthlystats.png" alt="Prayer Book Monthly Download Stats" title="Prayer Book Monthly Download Stats" width="541" height="125" class="size-full wp-image-80" /></p>
<p>Up until the writing this post, there have been 9,448 downloads of Prayer Book, with an average of 91 downloads a day. Not bad I think. December was a particularly interesting month, so I&#8217;ll share some more detailed numbers there.</p>
<p><img src="http://arashpayan.com/blog/wp-content/uploads/2009/01/prayerbookdecemberdownloads-300x196.jpg" alt="Prayer Book December Downloads" title="Prayer Book December Downloads" width="300" height="196" class="aligncenter size-medium wp-image-84" /></p>
<p>December was shaping up to be a pretty regular month, and then on the 22nd, there was a spike to 118 downloads, then a drop, and then another spike that lasted from the 25th-29th.</p>
<p>I only have data up to the 13th of January included in the monthly table above, but that&#8217;s already further ahead in downloads than the same time in December (941 downloads from December 1-13). Granted, December will probably still be better than January because of the Christmas activity.</p>
<p>Have any links to download numbers for other apps? Please share them in the comments. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/01/15/on-app-store-download-statistics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APXML: NSXMLDocument &#8216;substitute&#8217; for iPhone/iPod Touch</title>
		<link>http://arashpayan.com/blog/2009/01/14/apxml-nsxmldocument-substitute-for-iphoneipod-touch/</link>
		<comments>http://arashpayan.com/blog/2009/01/14/apxml-nsxmldocument-substitute-for-iphoneipod-touch/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 05:04:45 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[apxml]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=46</guid>
		<description><![CDATA[After spending some time working on Jabeh, my latest creation for iPhone/iPod Touch, I&#8217;m taking some time to dump a little learned knowledge into my blog. In my first app, my XML needs weren&#8217;t that great, so putting up with the lack of NSXMLDocument in the iPhone SDK was not a big deal. However, in [...]]]></description>
			<content:encoded><![CDATA[<p>After spending some time working on <a href="http://jabeh.org">Jabeh</a>, my latest creation for iPhone/iPod Touch, I&#8217;m taking some time to dump a little learned knowledge into my blog.</p>
<p>In my first app, my XML needs weren&#8217;t that great, so putting up with the lack of <code>NSXMLDocument</code> in the iPhone SDK was not a big deal. However, in <a href="http://jabeh.org">Jabeh</a> I was changing the XML format so often and using so much of it for my network communication creating delegates for <code>NSXMLParser</code> quickly became a huge time sink. After a little hacking, I came up with APXML to solve my DOM problem. It&#8217;s not a perfect implementation of the <a href="http://www.w3.org/TR/REC-xml/">W3C XML 1.0 standard</a>, but it&#8217;s close enough for a lot of usage. One particular shortcoming is its lack of support for namespaces but maybe somebody else can add that support. If you just want to jump in and start using it (LGPL license), you can get the code from github:</p>
<p><a href="http://github.com/arashpayan/apxml/">http://github.com/arashpayan/apxml/</a></p>
<p>Most of my XML manipulation experience has been with various Java libraries (<a href="http://java.sun.com/javase/6/docs/api/org/w3c/dom/package-summary.html">org.w3c.dom interface</a>, <a href="http://jdom.org/">JDOM</a> and <a href="http://xom.nu/">XOM</a>), and the only one that I enjoyed using was XOM, because of its simplicity and licensing. Almost all of my design decisions were based on how XOM does things.</p>
<p>Let&#8217;s say we want to represent the following XML document in memory using APXML:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#881280;">&lt;books&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;book </span><span style="color:#994500;">id</span><span style="color:#881280;">=</span><span style="color:#1a1aa6;">&quot;1&quot;</span><span style="color:#881280;"> </span><span style="color:#994500;">author</span><span style="color:#881280;">=</span><span style="color:#1a1aa6;">&quot;Michael Pollan&quot;</span><span style="color:#881280;">&gt;</span>The Omnivore&#8217;s Dilemma<span style="color:#881280;">&lt;/book&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;book </span><span style="color:#994500;">id</span><span style="color:#881280;">=</span><span style="color:#1a1aa6;">&quot;2&quot;</span><span style="color:#881280;"> </span><span style="color:#994500;">author</span><span style="color:#881280;">=</span><span style="color:#1a1aa6;">&quot;Foley, van Dam, Feiner, Hughes&quot;</span><span style="color:#881280;">&gt;</span>Computer Graphics: Principles and Practices<span style="color:#881280;">&lt;/book&gt;</span><br />
<span style="color:#881280;">&lt;/books&gt;</span></div>
<p>In code, we do the following:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#683821;">#import &quot;APXML.h&quot;<br />
</span><br />
<span style="color:#881350;">@implementation</span> AppDelegate</p>
<p>- (<span style="color:#881350;">void</span>)<span style="color:#6c0540;">applicationDidFinishLaunching:</span>(UIApplication *)application {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// create the document with it&#8217;s root element<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;APDocument *doc = [[APDocument <span style="color:#ff0000;">alloc</span>] <span style="color:#6c0540;">initWithRootElement:</span>[APElement <span style="color:#6c0540;">elementWithName:</span><span style="color:#760f15;">@&quot;books&quot;</span>]];<br />
&nbsp;&nbsp;&nbsp;&nbsp;APElement *rootElement = [doc <span style="color:#6c0540;">rootElement</span>]; <span style="color:#236e25;">// retrieves same element we created the line above<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// create the first book entry (The Omnivore&#8217;s Dilemma)<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;APElement *book1 = [APElement <span style="color:#6c0540;">elementWithName:</span><span style="color:#760f15;">@&quot;book&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[book1 <span style="color:#6c0540;">addAttributeNamed:</span><span style="color:#760f15;">@&quot;id&quot;</span> <span style="color:#6c0540;">withValue:</span><span style="color:#760f15;">@&quot;1&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[book1 <span style="color:#6c0540;">addAttributeNamed:</span><span style="color:#760f15;">@&quot;author&quot;</span> <span style="color:#6c0540;">withValue:</span><span style="color:#760f15;">@&quot;Michael Pollan&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[book1 <span style="color:#6c0540;">appendValue:</span><span style="color:#760f15;">@&quot;The Omnivore's Dilemma&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[rootElement <span style="color:#6c0540;">addChild:</span>book1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// create the second book entry (Computer Graphics)<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;APElement *book2 = [APElement <span style="color:#6c0540;">elementWithName:</span><span style="color:#760f15;">@&quot;book&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[book2 <span style="color:#6c0540;">addAttributeNamed:</span><span style="color:#760f15;">@&quot;id&quot;</span> <span style="color:#6c0540;">withValue:</span><span style="color:#760f15;">@&quot;2&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[book2 <span style="color:#6c0540;">addAttributeNamed:</span><span style="color:#760f15;">@&quot;author&quot;</span> <span style="color:#6c0540;">withValue:</span><span style="color:#760f15;">@&quot;Foley, van Dam, Feiner, Hughes&quot;</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;[rootElement <span style="color:#6c0540;">addChild:</span>book2];<br />
}</p>
<p><span style="color:#881350;">@end</span></div>
<p>And if we want to convert the document to an <code>NSString*</code>, we use one of the two methods in <code>APDocument</code>:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// converts the xml to a compact string with no newlines or tabs (good for production)<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSString</span> *xml = [doc <span style="color:#6c0540;">xml</span>];</div>
<p>or</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// converts the xml to an easy to read string with newlines and tabs (good for debugging)<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSString</span> *prettyXML = [doc <span style="color:#6c0540;">prettyXML</span>];</div>
<p>Often times when I&#8217;m working with XML, I like to see what the current element contains, so for added convenience, you can obtain an XML string containing the element you&#8217;re working with, its attributes and all its children directly from the <code>APElement</code> by calling one of two methods:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">- (<span style="color:#400080;">NSString</span>*)<span style="color:#6c0540;">prettyXML:</span>(<span style="color:#881350;">int</span>)tabs;<br />
- (<span style="color:#400080;">NSString</span>*)<span style="color:#6c0540;">xml</span>;</div>
<p>Now for the best part of the library, which is the ability to read in XML and represent it in APXML. All you have to execute is one simple line:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">&nbsp;&nbsp;&nbsp;&nbsp;APDocument *doc = [APDocument <span style="color:#6c0540;">documentWithXMLString:</span>xmlString];</div>
<p>Hopefully this will be helpful to other developers out there. I may post another article soon if anybody has some questions.</p>
<p><strong>UPDATE Sep 5, 2009:</strong> Here&#8217;s an example that demonstrates traversing the XML document.</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">&nbsp;&nbsp;&nbsp;&nbsp;APElement *rootElement = [doc <span style="color:#6c0540;">rootElement</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSLog</span>(<span style="color:#760f15;">@&quot;Root Element Name: %@&quot;</span>, rootElement.name);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// get all the child elements (each book)<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSArray</span> *childElements = [rootElement <span style="color:#6c0540;">childElements</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">for</span><span style="color:#003369;"> </span>(APElement *child in childElements)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// returns the tag name<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSLog</span>(<span style="color:#760f15;">@&quot;Child Name: %@&quot;</span>, child.name);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// reads the attribute named &#8216;author&#8217;<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSLog</span>(<span style="color:#760f15;">@&quot;Author: %@&quot;</span>, [child <span style="color:#6c0540;">valueForAttributeNamed:</span><span style="color:#760f15;">@&quot;author&quot;</span>]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// returns the text content of the element<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">NSLog</span>(<span style="color:#760f15;">@&quot;Title: %@&quot;</span>, [child <span style="color:#6c0540;">value</span>]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<p>In the console you&#8217;ll see (I&#8217;ve removed the <code>NSLog</code> markup):</p>
<div style="overflow:auto;">
<pre>
Root Element Name: books
Child Name: book
Author: Michael Pollan
Title: The Omnivore’s Dilemma
Child Name: book
Author: Foley, van Dam, Feiner, Hughes
Title: Computer Graphics: Principles and Practices
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2009/01/14/apxml-nsxmldocument-substitute-for-iphoneipod-touch/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Prayer Book for iPhone and iPod Touch</title>
		<link>http://arashpayan.com/blog/2008/10/02/prayer-book-for-iphone-and-ipod-touch/</link>
		<comments>http://arashpayan.com/blog/2008/10/02/prayer-book-for-iphone-and-ipod-touch/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 07:46:07 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Bahá'í]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Prayer Book]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=41</guid>
		<description><![CDATA[My first iPhone app has just been posted to the iTunes app store. It&#8217;s called Prayer Book and it contains 231 English prayers from the Writings of the Bahá&#8217;í Faith. They&#8217;re organized by categories and you can bookmark your favorite prayers for easy access as well. I&#8217;ll be updating the program over time with new [...]]]></description>
			<content:encoded><![CDATA[<p>My first iPhone app has just been posted to the iTunes app store. It&#8217;s called <a href="http://arashpayan.com/projects/PrayerBook/">Prayer Book</a> and it contains 231 English prayers from the Writings of the <a href="http://www.bahai.org">Bahá&#8217;í Faith</a>. They&#8217;re organized by categories and you can bookmark your favorite prayers for easy access as well. I&#8217;ll be updating the program over time with new features and prayer translations, and eventually I&#8217;d like to have all the Writings of the Bahá&#8217;í Faith in there.</p>
<p>It&#8217;s available for free on the iTunes store, so go ahead and <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=292151014&#038;mt=8">take it for a spin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2008/10/02/prayer-book-for-iphone-and-ipod-touch/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Installing iPhone firmware 2.1</title>
		<link>http://arashpayan.com/blog/2008/09/14/installing-iphone-firmware-21/</link>
		<comments>http://arashpayan.com/blog/2008/09/14/installing-iphone-firmware-21/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 22:35:42 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=39</guid>
		<description><![CDATA[Here&#8217;s a step by step on how to install the new 2.1 firmware using PwnageTool. I&#8217;m assuming that you&#8217;ve alread Pwned your phone before when you follow this tutorial. If you haven&#8217;t, the steps at the end may be a little different for you. Update to iTunes 8 and restart After the reboot, plug in [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a step by step on how to install the new 2.1 firmware using <a href="http://blog.iphone-dev.org/post/49988701/pwnagetool-and-quickpwn-for-2-1-firmware">PwnageTool</a>. I&#8217;m assuming that you&#8217;ve alread Pwned your phone before when you follow this tutorial. If you haven&#8217;t, the steps at the end may be a little different for you.</p>
<ol>
<li>Update to iTunes 8 and restart
<li>After the reboot, plug in your phone, then open up iTunes. It will ask if you want to update your phone. Click &#8216;Download only&#8217;. If you accidentally clicked cancel, just click on your phone in the iTunes sidebar, then click &#8216;Update&#8217; to get the latest firmware. Then once the download starts, unplug your iPhone from the USB port.
<li>Once the download finishes, close iTunes
<li>Open up the &#8216;Activity Monitor&#8217; app from /Applications/Utilities. Find the &#8216;iTunes Helper&#8217; in the list of running programs and kill it (the red button at the top left).
<li>Set your phone&#8217;s auto-lock to never (Settings->General->Auto Lock->Never)
<li>After downloading PwnageTool and copying it to your /Applications folder, launch the program.
<li>Select your device (I&#8217;m using the original iPhone) and click the next arrow.
<li>PwnageTool will search for the ipsw firmware file you just downloaded (and it should find it). Select it and click the next arrow.
<li>Now PwnageTool will look for the bootloader v4.6 and 3.9 files. If you don&#8217;t have them, you can download them <a href="http://drop.io/zmyh83n">here</a>. After downloading the files, click &#8216;No&#8217; to searching the web for the bootloader file. At the next dialog, click &#8216;Yes&#8217; to browse for the location where you downloaded the file.
<li>Now PwnageTool will ask you if you have an iPhone contract that would normally activate through iTunes. If you are using the Apple approved carrier in your country, you can click &#8216;Yes&#8217;, and this will skip the unlocking process on your phone. Just say &#8216;No&#8217; if you want your phone unlocked.
<li>Now PwnageTool will build an ipsw file for your phone.
<li>After the file is created, close PwnageTool, disconnect and turn off your phone, and open up iTunes.
<li>Now we need to put the phone into recovery mode. While the phone is off, hold down the &#8216;Home&#8217; button, and at the same time plug your phone into your Mac. Keep holding down the &#8216;Home&#8217; button until iTunes tells you that your phone is in recovery mode and needs to be restored.
<li>In iTunes, hold down the option key and click &#8216;Restore.&#8217; Select the new firmware file that PwnageTool just created, and you should be good to go in about 10 minutes.
<li>Enjoy your updated phone!
</ol>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2008/09/14/installing-iphone-firmware-21/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open links from UIWebView in MobileSafari</title>
		<link>http://arashpayan.com/blog/2008/09/06/open-links-from-uiwebview-in-mobilesafari/</link>
		<comments>http://arashpayan.com/blog/2008/09/06/open-links-from-uiwebview-in-mobilesafari/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 08:13:39 +0000</pubDate>
		<dc:creator>arash</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[mobilesafari]]></category>
		<category><![CDATA[uiwebview]]></category>

		<guid isPermaLink="false">http://arashpayan.com/blog/?p=37</guid>
		<description><![CDATA[If you&#8217;ve embedded a UIWebView in your iPhone/iPod app, you may not want the user to suffer through surfing all successive pages through it. Instead, you can open up your first page inside a UIWebView and any links the user tries to follow will instead open up in MobileSafari. All you need to do is [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve embedded a <code>UIWebView</code> in your iPhone/iPod app, you may not want the user to suffer through surfing all successive pages through it. Instead, you can open up your first page inside a <code>UIWebView</code> and any links the user tries to follow will instead open up in MobileSafari.</p>
<p>All you need to do is set the <code>UIWebView</code>&#8216;s delegate, to an object that implements the optional method <code>webView:shouldStartLoadWithRequest:navigationType:</code> (part of the <code>UIWebViewDelegate</code> protocol). Then whenever the initial page is loaded or a link is followed in that view, the delegate&#8217;s method will be called. You&#8217;ll want to return <code>YES</code> for the page you initially load, and then return <code>NO</code> for all others, and open the URL in MobileSafari. Here&#8217;s what the method implementation should look like:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">- (<span style="color:#881350;">BOOL</span>)<span style="color:#6c0540;">webView:</span>(UIWebView *)webView<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#6c0540;">shouldStartLoadWithRequest:</span>(<span style="color:#400080;">NSURLRequest</span> *)request<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#6c0540;">navigationType:</span>(UIWebViewNavigationType)navigationType<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">if</span><span style="color:#003369;"> </span>([[[request <span style="color:#6c0540;">URL</span>] <span style="color:#6c0540;">absoluteString</span>] <span style="color:#6c0540;">isEqual:</span><span style="color:#760f15;">@&quot;http://arashpayan.com/myInitialPage/&quot;</span>])<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">return</span> <span style="color:#881350;">YES</span>;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;[[UIApplication <span style="color:#6c0540;">sharedApplication</span>] <span style="color:#6c0540;">openURL:</span>[request <span style="color:#6c0540;">URL</span>]];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">return</span> <span style="color:#881350;">NO</span>;<br />
}</div>
<p>By returning <code>NO</code> from the delegate method, we&#8217;re telling the web view not to load the link the user tapped, but instead we redirect the opening of the link to <code>[UIApplication openURL:]</code> (MobileSafari).</p>
]]></content:encoded>
			<wfw:commentRss>http://arashpayan.com/blog/2008/09/06/open-links-from-uiwebview-in-mobilesafari/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

