<?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>Leoganda.net &#187; IPhone</title>
	<atom:link href="http://www.leoganda.net/tag/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leoganda.net</link>
	<description></description>
	<lastBuildDate>Tue, 25 May 2010 16:33:44 +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>XML-RPC on IPhone</title>
		<link>http://www.leoganda.net/xml-rpc-on-iphone/</link>
		<comments>http://www.leoganda.net/xml-rpc-on-iphone/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 12:38:18 +0000</pubDate>
		<dc:creator>leoganda</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[IPhone]]></category>
		<category><![CDATA[XMLRPC]]></category>

		<guid isPermaLink="false">http://www.leoganda.net/?p=28</guid>
		<description><![CDATA[Hi, after play along to implement XML-RPC on IPhone finally I made it. I tried googling to find some articles that related to XML-RPC on IPhone, and those article drag me to WordPress application for IPhone. This application using XML RPC to communicate IPhone with the WordPress Blog, so the idea is grab the XML-RPC [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, after play along to implement XML-RPC on IPhone finally I made it. I tried googling to find some articles that related to XML-RPC on IPhone, and those article drag me to WordPress application for IPhone. This application using XML RPC to communicate IPhone with the WordPress Blog, so the idea is grab the XML-RPC function from the WP application and implement it on our application. First we need to download WordPress for IPhone source code, you can <a href="http://iphone.trac.wordpress.org/changeset/336/tags/1.21?old_path=%2F&amp;format=zip" target="_blank">download it here.</a><span id="more-28"></span></p>
<p>Once you download the source code, extract it. You will find a folder named Class, under the Class folder you will find XMLRPC folder. We need to import this folder (with the file inside) to our project, and also import <strong>NSString+XMLExtensions.h</strong> and <strong>NSString+XMLExtensions.m.</strong></p>
<p>I will show you how to implement this XML-RPC on simple application.</p>
<p>Start your XCode program, make new &#8220;View-based Application&#8221; project.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-1.png"><img title="Picture 1" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-1.png" alt="Picture 1" width="409" height="159" /></a></p>
<p>Name the project with &#8220;XMLRPC-sayHello&#8221;.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-2.png"><img title="Picture 2" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-2.png" alt="Picture 2" width="480" height="93" /></a></p>
<p>Once the workspace opened, import the XMLRPC folder from WordPress source code to our project. Right click on Class folder, Add-&gt;Existing files</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-3.png"><img title="Picture 3" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-3.png" alt="Picture 3" width="454" height="206" /></a></p>
<p>Then browse to the WordPress for Iphone source code, and select the XMLRPC folder. Click the &#8220;Add&#8221; button. The next is import the <strong>NSString+XMLExtensions.h</strong> and <strong>NSString+XMLExtensions.m </strong>files to our project.</p>
<p>Your project files will be look like this.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-4.png"><img title="Picture 4" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-4.png" alt="Picture 4" width="295" height="423" /></a></p>
<p>Ok the import step is done, now we need to design UI. We will make a simple interface with Label and Button only. The final design will be look like this.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-5.png"><img title="Picture 5" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-5-154x300.png" alt="Picture 5" width="154" height="300" /></a></p>
<p>To design the UI, double click the XMLRPC_SayHelloViewController.xib file and the interface builder will show up. On interface builder Drag a label from the library and change the text to &#8220;Response&#8221;. Next drag the Round Rect Button, and change the text to &#8220;Get Response&#8221;. Once done, close the interface builder and back to XCode.</p>
<h3>Coding</h3>
<p>Open the XMLRPC_SayHelloViewController.h, we will import the header files that used for XMLRPC, that are XMLRPCResponse.h, XMLRPCRequest.h, and XMLRPCConection.h. We also declare the label and the getResponse method in our header file. It should be look like this.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-7.png"><img title="Picture 7" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-7.png" alt="Picture 7" width="382" height="215" /></a></p>
<p>Once you done with the XMLRPC_SayHelloViewController.h, double click the XMLRPC_SayHelloViewController.xib to reopen the interface builder, we will connect the code with the interface. Open the Inspector window first Tools-&gt;Inspector.</p>
<p>Click the Response label in designer, then in the Inspector window it will be shown &#8220;New Referencing Outlet&#8221;. Drag the right circle of &#8220;New Referencing Outlet&#8221; to File&#8217;s Owner. See image.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-81.png"><img title="Picture-8" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-81.png" alt="Picture-8" width="618" height="303" /></a></p>
<p>When you release the mouse button, choose the &#8220;lblResponse&#8221; from the pop up window.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-9.png"><img title="Picture 9" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-9.png" alt="Picture 9" width="592" height="151" /></a></p>
<p>Ok, now select the Button on the interface, and drag the right circle button on the &#8220;Touch Down&#8221; inspector window to File&#8217;s Owner.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-10.png"><img title="Picture 10" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-10.png" alt="Picture 10" width="268" height="271" /></a></p>
<p>Once you finished editing the interface, save it and we continue with the coding.</p>
<p>Open the XMLRPC_SayHelloViewController.m and add the following code.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-11.png"><img title="Picture 11" src="http://www.leoganda.net/wp-content/uploads/2009/08/Picture-11.png" alt="Picture 11" width="585" height="403" /></a></p>
<p>You can change the server path to your own path, and don&#8217;t forget to enable the XMLRPC on your wordpress installation. On wordpress XMLRPC there is demo.sayHello method that returns &#8220;hello&#8221; string, so I used this for the example.</p>
<p>Tadda! It&#8217;s done! Run the emulator by pressing command+enter button. Once running, press the &#8220;Get Response&#8221; button, that will invoke the getResponse method and show up the result to lblResponse.</p>
<p><a href="http://www.leoganda.net/wp-content/uploads/2009/08/XMLRPC-SayHello.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.leoganda.net/xml-rpc-on-iphone/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>
