<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>dejalatele's personal blog - iOS</title>
    <link>http://dejalatele.com/</link>
    <description>My little place on the web...</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.5 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://dejalatele.com/templates/bulletproof_fork/img/s9y_banner_small.png</url>
        <title>RSS: dejalatele's personal blog - iOS - My little place on the web...</title>
        <link>http://dejalatele.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Launching the iPhone simulator using Apache Ant</title>
    <link>http://dejalatele.com/archives/7-Launching-the-iPhone-simulator-using-Apache-Ant.html</link>
            <category>iOS</category>
    
    <comments>http://dejalatele.com/archives/7-Launching-the-iPhone-simulator-using-Apache-Ant.html#comments</comments>
    <wfw:comment>http://dejalatele.com/wfwcomment.php?cid=7</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://dejalatele.com/rss.php?version=2.0&amp;type=comments&amp;cid=7</wfw:commentRss>
    

    <author>nospam@example.com (Antonio Diaz Ruiz)</author>
    <content:encoded>
    Here&#039;s the XML of an &lt;a href=&quot;http://ant.apache.org/&quot;&gt;Apache Ant&lt;/a&gt; buildfile that allows the execution of an iPhone application on the iPhone simulator.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
&amp;lt;project name=&quot;my-iPhone-project&quot;&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;xcodebuild&quot; value=&quot;path_to_xcodebuilder_execuitable&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;sdk&quot; value=&quot;5.1&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;build_path&quot; value=&quot;/myhomepath/my_builds_folder&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;application_path&quot; value=&quot;${build_path}/Applications/my_iOS_application.app/my_application&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;property name=&quot;simulator_path&quot; value=&quot;/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;target name=&quot;run&quot; depends=&quot;install, simulator&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;target name=&quot;build&quot; depends=&quot;clean, make&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;target name=&quot;clean&quot;&amp;gt;&lt;br /&gt;
&amp;lt;delete dir=&quot;build&quot; failonerror=&quot;false&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;xcodebuild target=&quot;my_application_target&quot;&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;clean&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/xcodebuild&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;target name=&quot;make&quot;&amp;gt;&lt;br /&gt;
&amp;lt;xcodebuild target=&quot;my_application_target&quot;&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;build&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/xcodebuild&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;target name=&quot;install&quot; depends=&quot;build&quot;&amp;gt;&lt;br /&gt;
&amp;lt;xcodebuild target=&quot;my_application_target&quot;&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;install&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/xcodebuild&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;target name=&quot;simulator&quot;&amp;gt;&lt;br /&gt;
&amp;lt;iphone_simulator/&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macrodef name=&quot;xcodebuild&quot;&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;dir&quot; default=&quot;/myhomepath/my_application_source_code_folder&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;builddir&quot; default=&quot;${build_path}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;failonerror&quot; default=&quot;true&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;target&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;sdk&quot; default=&quot;${sdk}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;configuration&quot; default=&quot;${configuration}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;element name=&quot;args&quot; optional=&quot;true&quot; implicit=&quot;true&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;sequential&amp;gt;&lt;br /&gt;
&amp;lt;exec executable=&quot;${xcodebuild}&quot; dir=&quot;@{dir}&quot; failonerror=&quot;@{failonerror}&quot;  failifexecutionfails=&quot;@{failonerror}&quot;&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;-target&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;@{target}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;-sdk&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;@{sdk}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;-configuration&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;@{configuration}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;SYMROOT=@{builddir}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;DSTROOT=@{builddir}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;args/&amp;gt;&lt;br /&gt;
&amp;lt;/exec&amp;gt;&lt;br /&gt;
&amp;lt;/sequential&amp;gt;&lt;br /&gt;
&amp;lt;/macrodef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macrodef name=&quot;iphone_simulator&quot;&amp;gt;&lt;br /&gt;
&amp;lt;attribute name=&quot;applicationpath&quot; default=&quot;${application_path}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;sequential&amp;gt;&lt;br /&gt;
&amp;lt;exec executable=&quot;${simulator_path}&quot; spawn=&quot;true&quot;&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;-SimulateApplication&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;@{applicationpath}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;arg value=&quot;&amp;amp;&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/exec&amp;gt;&lt;br /&gt;
&amp;lt;/sequential&amp;gt;&lt;br /&gt;
&amp;lt;/macrodef&amp;gt;&lt;br /&gt;
&amp;lt;/project&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
What you should see when you save this build file and run Ant is &lt;em&gt;xcodebuilder&lt;/em&gt; will start to clean, build and install our application, and when &lt;em&gt;xcodebuilder&lt;/em&gt; will finish the iPhone simulater will start automatically to run our application.&lt;br /&gt;
&lt;br /&gt;
Some key points here are the following:&lt;br /&gt;
- The xcodebuild property is the path to the xcodebuilder executable.&lt;br /&gt;
- The sdk property should be the iOS version you want to run your application.&lt;br /&gt;
- The build_path property is the path where &lt;em&gt;xcodebuilder&lt;/em&gt; will build and install the application.  It could be any path.  Notice that this property is passed into the macro responsible of the &lt;em&gt;xcodebuilder&lt;/em&gt; execution.&lt;br /&gt;
- The application_path property is the path of the application inside the build path.  It should be similar to the example above because &lt;em&gt;xcodebuilder&lt;/em&gt; installs the applications on folder called  &lt;em&gt;Applications&lt;/em&gt;.&lt;br /&gt;
- The simulator_path property is the path of the simulator executable.&lt;br /&gt;
- You should specify the target of the application by the attribute &lt;em&gt;target&lt;/em&gt; in all the &lt;em&gt;xcodebuilder&lt;/em&gt; calls.  &lt;strong&gt;Don&#039;t confuse&lt;/strong&gt; the application target with the Ant targets.&lt;br /&gt;
- The macro &lt;em&gt;xcodebuild&lt;/em&gt; contains the necessary code to call the &lt;em&gt;xcodebuilder&lt;/em&gt; executable.  Pay attention to the first attribute &lt;em&gt;dir&lt;/em&gt;, it is the path to the source code of your application.  Your can use the same attributes and arguments as in the example, but it is advisable to check man page of &lt;em&gt;xcodebuilder&lt;/em&gt; for a better understanding of the meaning of each available arguments.  Be careful with the order of the arguments inside the &lt;em&gt;sequential&lt;/em&gt; Ant container because it executes the nested tasks in sequence, so if you wrongly modify the order of the arguments, &lt;em&gt;xcodebuild&lt;/em&gt; will not run.&lt;br /&gt;
- Finally the &lt;em&gt;iphone_simulator&lt;/em&gt; macro will run the simulator starting your application.  The last argument (the ampersand) is passed with the only purpose of execute the simulator in background.&lt;br /&gt;
&lt;br /&gt;
This build file can be used in various ways but the most useful could be the launch of automated tests.  
    </content:encoded>

    <pubDate>Sun, 29 Jan 2012 21:01:00 +0100</pubDate>
    <guid isPermaLink="false">http://dejalatele.com/archives/7-guid.html</guid>
    
</item>
<item>
    <title>Avoiding crashes</title>
    <link>http://dejalatele.com/archives/3-Avoiding-crashes.html</link>
            <category>iOS</category>
    
    <comments>http://dejalatele.com/archives/3-Avoiding-crashes.html#comments</comments>
    <wfw:comment>http://dejalatele.com/wfwcomment.php?cid=3</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://dejalatele.com/rss.php?version=2.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    

    <author>nospam@example.com (Antonio Diaz Ruiz)</author>
    <content:encoded>
    When we doing test automation for iPhone or iPad using the &lt;a href=&quot;http://code.google.com/p/uispec/&quot;&gt;UISpec&lt;/a&gt; framework we have to pay attention to the existence or not of the UI elements we interact with.  If we try to touch a button, fill in a text field or perform any kind of interaction with an element and the element doesn&#039;t exist the Test application will crash and will stop the execution of the rest of specs.  So, we have to check the existence of the element before try to interact with them.  We can avoid the crash setting expectations before interact with the element.  &lt;br /&gt;
Let&#039;s imagine a screen with two buttons and we want to touch the second one, the UIquery code of the button is&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
[[[app button] index:1] touch];&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
If this code is not correct or the button is no present on the screen the application which run the tests will crash, but if we set the expectation before the interaction &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
[expectThat([app button] index:1]) should:be(YES)];&lt;br /&gt;
[[[app button] index:1] touch];&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
as the expectation will not be satisfied the execution of this spec will finish at this point but it won&#039;t finish the execution of the whole test application.  It will continue with the next spec.&lt;br /&gt;
&lt;br /&gt;
A more elaborated implementation could be&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
    BOOL existElement;&lt;br /&gt;
&lt;br /&gt;
    @try {&lt;br /&gt;
        existElement = [[[[app button] index:1] should] exist];&lt;br /&gt;
    }&lt;br /&gt;
    @catch (NSException *exception) {&lt;br /&gt;
        NSLog(@&quot;EXCEPTION CAUSED BY: %@&quot;, [NSThread callStackSymbols]);&lt;br /&gt;
    }&lt;br /&gt;
    @finally {&lt;br /&gt;
        [expectThat(existElement) should:be(YES)];&lt;br /&gt;
    }&lt;br /&gt;
&lt;/div&gt; 
    </content:encoded>

    <pubDate>Fri, 13 Jan 2012 19:41:29 +0100</pubDate>
    <guid isPermaLink="false">http://dejalatele.com/archives/3-guid.html</guid>
    
</item>

</channel>
</rss>
