<?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>Touch Code Magazine</title>
	<atom:link href="http://www.touch-code-magazine.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.touch-code-magazine.com</link>
	<description>Tutorials and excerpts about iPhone and iPad programming in Objective-C and Cocoa Touch</description>
	<lastBuildDate>Mon, 23 Jan 2012 16:49:35 +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>Unit testing for blocks based APIs</title>
		<link>http://www.touch-code-magazine.com/unit-testing-for-blocks-based-apis/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=unit-testing-for-blocks-based-apis</link>
		<comments>http://www.touch-code-magazine.com/unit-testing-for-blocks-based-apis/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 16:34:20 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[blocks]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[semaphore]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[unit]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1139</guid>
		<description><![CDATA[In this article I’m not going to explain how unit tests work and so on, but I’d rather cover how to overcome some obstacles if you are writing unit tests for block based APIs.

Unlike your iPhone apps the unit test suite is being started, it runs the code of all tests and then when there’s nothing more to run it just exists. If it didn’t spit any exception, the test was successful. End of story.

So let’s see how that pairs up with using blocks.]]></description>
			<content:encoded><![CDATA[<p>Unit tests are very useful for those large projects where you might loose sight of everything that’s going on and while you are adding new code to add feature X you might be silently breaking feature Y without even suspecting. It’s super easy these days to add unit tests to your Xcode project &#8211; when you create new Xcode project just check the checkbox in the save dialogue and voila everything is setup automatically for you:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_1.png"><img class="alignnone size-full wp-image-1142" title="utb_1" src="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_1.png" alt="" width="385" height="90" /></a></p>
<p>This will add unit testing to your project and when you click Product-&gt;Test from Xcode’s menu your unit test will be run. Cool and smooth.</p>
<p>Let’s have a look at the default unit test, which is created for you- you get a folder called “[Project name]Tests” and inside there’s one test pre-set for you. Open the .m file and find the only test inside:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>testExample
<span style="color: #002200;">&#123;</span>
    STFail<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Unit tests are not implemented yet in utb_testTests&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>It’s designed so that it’ll fail by default. Eventually if you run the tests (Cmd+U) you’ll see the tests fail (<em>though my experience shows even this simple example test will succeed for no reason many times</em>):</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_21.gif"><img class="alignnone size-full wp-image-1143" title="utb_2" src="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_21.gif" alt="" width="233" height="185" /></a></p>
<p>So in this article I’m not going to explain how unit tests work and so on, but I’d rather cover how to overcome some obstacles if you are writing unit tests for block based APIs.</p>
<p><span id="more-1139"></span></p>
<p>Unlike your iPhone apps the unit test suite is being started, it runs the code of all tests and then when there’s nothing more to run it just exists. If it didn’t spit any exception, the test was successful. End of story.</p>
<p>So let’s see how that pairs up with using blocks. Let’s replace the content of the test method with this code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>testExample
<span style="color: #002200;">&#123;</span>
    CLGeocoder<span style="color: #002200;">*</span> gc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>CLGeocoder alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>gc geocodeAddressString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Hermannplatz, Berlin, Germany&quot;</span>
     completionHandler<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>placemarks, <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
&nbsp;
         STFail<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Failed inside a block&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
     <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>This code creates a new geocoder and asks for matches for the given address. Since the API is asynchronous the results are fetched inside the provided block. You’ll need to also add an import at the top of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &amp;lt;CoreLocation/CoreLocation.h&amp;gt;</span></pre></div></div>

<p>and of course add the CoreLocation.framework to the project.</p>
<p>Hit Cmd+U and &#8230; the test passes. Inevitably and always.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_3.png"><img class="alignnone size-full wp-image-1144" title="utb_3" src="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/utb_3.png" alt="" width="230" height="185" /></a></p>
<p>So why does this happen?</p>
<p>The test suit doesn’t wait for and don’t know that you are waiting for geocoding results from Apple’s server. It runs all the code and then when there’s no more code to run &#8211; exits.</p>
<p>Problem?</p>
<p>You actually need to make the application hang around alive until you get the results for the geocoding server and only tell it &#8220;i finished my work you can exit now please&#8221;. But naturally if you just tell the app to sleep it won&#8217;t be able to react when the results come back from the server &#8230;</p>
<p>Some diggin’ through StackOverflow finds me this solution which I really like:</p>
<p><a href="http://stackoverflow.com/a/4326754/208205" target="_blank">http://stackoverflow.com/a/4326754/208205</a></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">dispatch_semaphore_t sema <span style="color: #002200;">=</span> dispatch_semaphore_create<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>object runSomeLongOperationAndDo<span style="color: #002200;">:^</span><span style="color: #002200;">&#123;</span>
    STAssert…
&nbsp;
    dispatch_semaphore_signal<span style="color: #002200;">&#40;</span>sema<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
dispatch_semaphore_wait<span style="color: #002200;">&#40;</span>sema, DISPATCH_TIME_FOREVER<span style="color: #002200;">&#41;</span>;
dispatch_release<span style="color: #002200;">&#40;</span>sema<span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>Using Grand Central Dispatch and its C functions you can create a semaphore object and wait till the signal comes in. However there are 2 things I don’t like in this code:</p>
<ol>
<li>using C functions and</li>
<li>I have rather complex class structure of classes, so passing reference to the semaphore is rather inconvenient.</li>
</ol>
<p>So I quickly came up with a simple class to implement my own semaphore. It has two handy methods &#8211; waitForKey:(NSString*)key and lift:(NSString*)key &#8230; and here’s how you use it:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>testExample
<span style="color: #002200;">&#123;</span>
    CLGeocoder<span style="color: #002200;">*</span> gc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>CLGeocoder alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>gc geocodeAddressString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Hermannplatz, Berlin, Germany&quot;</span>
     completionHandler<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>placemarks, <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
&nbsp;
         STFail<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Failed inside a block&quot;</span><span style="color: #002200;">&#41;</span>;
         <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>TestSemaphore sharedInstance<span style="color: #002200;">&#93;</span> lift<span style="color: #002200;">:</span>@”geocode1”<span style="color: #002200;">&#93;</span>;
     <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>TestSemaphore sharedInstance<span style="color: #002200;">&#93;</span> waitForKey<span style="color: #002200;">:</span>@”geocode1”<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Pretty straight forward &#8211; and since it’s a singleton class you can call it from wherever you want. Also it is free and available for download if you want to tingle with unit testing. And hey &#8211; it’s a semaphore, so you can use it for whatever purpose suits you <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2012/01/TestSemaphore.zip">Sempahore code download</a></p>
<p>Marin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/unit-testing-for-blocks-based-apis/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to deal with copycats?</title>
		<link>http://www.touch-code-magazine.com/how-to-deal-with-copycats/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-deal-with-copycats</link>
		<comments>http://www.touch-code-magazine.com/how-to-deal-with-copycats/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 08:37:48 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[blood]]></category>
		<category><![CDATA[booth]]></category>
		<category><![CDATA[copycats]]></category>
		<category><![CDATA[doodle]]></category>
		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1132</guid>
		<description><![CDATA[When you create an application in iTunes connect it automatically checks whether an app with the same name exists and doesn&#8217;t allow you to create your new app if yes. However you can always add an exclamation mark in the end of the app name or &#8220;HD&#8221; or &#8220;Lite&#8221; or whatever else and you are [...]]]></description>
			<content:encoded><![CDATA[<p>When you create an application in iTunes connect it automatically checks whether an app with the same name exists and doesn&#8217;t allow you to create your new app if yes. However you can always add an exclamation mark in the end of the app name or &#8220;HD&#8221; or &#8220;Lite&#8221; or whatever else and you are ready to go. It looks like some people are up to doing exactly that in hope to steal some of the search results when customers are looking to buy some relatively popular apps (but not too popular right, not willing to deal with lawyers here &#8211; just grabbing a bit of dough under the radar)</p>
<p>Let&#8217;s have a look at few apps:<span id="more-1132"></span></p>
<h2>Doodle Booth</h2>
<p><strong>DoodleBooth</strong> is a free app for iPhone (released by me, hehe) it has 6 updates with new content and functionalities over the course of 1 year and it also has 2 version for iPad &#8211; <strong>Doodle Booth HD</strong> and <strong>Doodle Booth HD Free</strong> &#8211; the iPad versions also have 3 updates with content and new features. You can from iTunes to the publisher web site (Underplot Apps) and have also a feedback form, from where people send us questions or just thanks, etc.</p>
<p>Doodle Booth is released on January the 14th, 2011</p>
<p>Now let&#8217;s have a look at a totally different application (but in a way very similar one)</p>
<p>Introducing: <strong>Doodle Booth Cam HD Lite </strong></p>
<p>Sounds familiar? Yup &#8211; they stuck a &#8220;Cam&#8221; in there, but otherwise pretty similar. Let&#8217;s have a look &#8211; released on the 1st of September, 2011. It never had ANY updates or bug fixes, it has ONE screenshot, which doesn&#8217;t show anything from the user interface. And guess what &#8211; they don&#8217;t have a web site OR any support page (as Apple requires devs to) &#8230; on the other hand they have over a hundred apps on the App Store. Great. Good job fantom publisher &#8220;Pop-ok.com&#8221;!</p>
<p>Let&#8217;s have a look at another example:</p>
<h2>Blood Booth</h2>
<p><strong>Blood Booth</strong> is another app of mine (very similar to Doodle Booth, but on another topic) released on February the 26th, 2011 &#8211; it has one cumulative update with bug fixes and content updates. Again you can go to our publisher web site and contact us via the support form.</p>
<p>Now let&#8217;s fast forward to October the 1st, 2011 &#8211; <strong>Blood Booth ultd</strong> is released. Sounds familiar? Yeah &#8211; they added &#8220;ultd&#8221; at the end of the name. Again a fantom developer with no web site or support page (I&#8217;m wondering whether Apple checks these things at all anymore?) Also have a look at part of the app description &#8220;<em>What would you look like with a &#8220;few&#8221; extra pounds? And what about your friends?<br />
Find out with BloodBooth, a fun way to instantly supersize faces on your iPhone or iPod Touch.</em>&#8221; Notice something? The text is copied from a fat booth application &#8211; it&#8217;s not relevant to the app at all! Again &#8211; one release, no bug fixes or updates. But wait there&#8217;s more &#8211; and it&#8217;s funnier:</p>
<p>the app is copyright of &#8220;blood booth llc 2008-2001&#8243; and wait for it &#8230; it is released by &#8220;BEST BOOTH SANTA XMAS LIMITED&#8221; &#8211; notice how the name of the publisher is SEO optimized for the holidays? but wait there&#8217;s even more &#8211; previously (before the holiday season) the publisher was known as &#8220;DOODLE  BIRDS JUMP CALL DUTY&#8221; &#8211; notice how it contains words from 4 best selling apps? lol</p>
<h2>So &#8230; ?</h2>
<p>Well &#8230; I&#8217;d wildly guess one can&#8217;t do much about copycats, but please (!) if you have recommendations &#8211; share in the comments &#8211; I guess many of the dear readers would be interested to hear what the others have to say on the topic.</p>
<p>I&#8217;m also wondering where Apple sits in all this?</p>
<p>Meanwhile I&#8217;m just trying to be better than the copycats, maybe that&#8217;ll be enough to stay afloat?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/how-to-deal-with-copycats/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Software that completes me as an iOS developer/publisher</title>
		<link>http://www.touch-code-magazine.com/software-that-completes-me-as-an-ios-developerpublisher/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=software-that-completes-me-as-an-ios-developerpublisher</link>
		<comments>http://www.touch-code-magazine.com/software-that-completes-me-as-an-ios-developerpublisher/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 14:05:20 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[bean]]></category>
		<category><![CDATA[call of duty]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[dash]]></category>
		<category><![CDATA[evernote]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[iconify]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[majic rank]]></category>
		<category><![CDATA[paid]]></category>
		<category><![CDATA[particle designer]]></category>
		<category><![CDATA[photoshop elements]]></category>
		<category><![CDATA[physics editor]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[texture packer]]></category>
		<category><![CDATA[world of goo]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1101</guid>
		<description><![CDATA[When I started doing iOS development was pretty much everyone for himself and that was scary. Now on the other hand there&#8217;s a healthy software eco-system build around iOS and iOS development and by investing few bucks you get such a belt of power-tools that creating indie apps was never easier. Here&#8217;s a round-up of [...]]]></description>
			<content:encoded><![CDATA[<p>When I started doing iOS development was pretty much everyone for himself and that was scary. Now on the other hand there&#8217;s a healthy software eco-system build around iOS and iOS development and by investing few bucks you get such a belt of power-tools that creating indie apps was never easier. Here&#8217;s a round-up of what  I really can&#8217;t do without:</p>
<h2>Coding and development</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/xcode_icon.png"><img class="alignnone size-full wp-image-1102" title="xcode_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/xcode_icon.png" alt="" width="182" height="168" /></a></td>
<td>Well, yes &#8211; without Xcode nothing of it would be possible. And believe me I used quite many IDEs throughout the years like Delphi, Eclipse and Visual Studio, and I really wanna say that Xcode is great. Not always flawless or bug-free, but still a fantastic IDE. Go Apple!<br />
You can get Xcode for free if you are registered Apple Developer &#8211; more info here:<br />
<a title="Xcode" href="http://developer.apple.com/xcode/" target="_blank">http://developer.apple.com/xcode/</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/dash_icon.png"><img class="alignnone size-full wp-image-1103" title="dash_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/dash_icon.png" alt="" width="201" height="196" /></a></td>
<td>Dash is a handy little app that takes away the burden of using Xcode 4 built-in help/documentation. Dash stays in your tray bar and pops up when you press &#8220;Alt + Space bar&#8221; gives you super fast iOS SDK documentation search and more &#8211; it remembers what you have looked up last, and unlike Xcode 4 it gives you the TOC and more.</p>
<p>This app was priceless while I was writing for &#8220;<a title="iOS5 by Tutorials" href="http://www.touch-code-magazine.com/iOS5ByTutorials" target="_blank">iOS5 by Tutorials</a>&#8221; because I had to constantly dig through the new API references. Much recommended, you can get it from the app store &#8211; it&#8217;s FREE:</p>
<p><a title="Dash on the App Store" href="http://itunes.apple.com/app/dash/id458034879?mt=12" target="_blank">http://itunes.apple.com/app/dash/id458034879?mt=12</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/coda_icon.png"><img class="alignnone size-full wp-image-1104" title="coda_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/coda_icon.png" alt="" width="182" height="179" /></a></td>
<td>Coda is the most fantastic all-in-one web editor. Some years ago I downloaded the trial version because I had to quickly start on a web project and few days into the trial period I already went ahead and bought the full version &#8211; I didn&#8217;t need any more convincing.</p>
<p>Coda is priceless when you need to deal with any text files, especially useful for creating web pages, has super intelligent built-in FTP, SFTP and SVN, and much more. Priceless &#8230; I also have Espresso (built after Coda), but I feel Coda is much better. Get Coda at Panic&#8217;s web site for 99$: <a title="Coda Panic.com" href="https://www.panic.com/coda/" target="_blank">http://www.panic.com/coda/</a></td>
</tr>
</tbody>
</table>
<p><span id="more-1101"></span></p>
<h2>Graphics and other *visual* stuff</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/photoshop_el_icon.png"><img class="alignnone size-full wp-image-1105" title="photoshop_el_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/photoshop_el_icon.png" alt="" width="196" height="178" /></a></td>
<td>Graphics Editor is the only category where I really don&#8217;t vouch for indie software. After I moved to the Mac I bought at least 5 different independent editors, but all of them were actually an impediment in my workflow. So in the end I turned to an older version Adobe Photoshop Elements, which came bundled with a tablet.</p>
<p>I have version 6 as I don&#8217;t have right now money to upgrade to version 10, but I can say Photoshop Elements does everything much better than indie software and more. I&#8217;m very happy with it.</p>
<p>You can get only the Photoshop Elements 10 Editor from the App Store for $79.99 : <a title="Adobe Photoshop Elements 10" href="http://itunes.apple.com/app/adobe-photoshop-elements-10/id465291110?mt=12" target="_blank">http://itunes.apple.com/app/adobe-photoshop-elements-10/id465291110?mt=12</a></p>
<p>Or alternatively if you want not only the editor but also all the other crap that Adobe bundles with Photoshop, you can get the &#8220;full&#8221; Photoshop Elements from Adobe&#8217;s web-site (hurry, there&#8217;s discount till 3rd of Jan, 2012): <a title="Adobe Photoshop Elements 10" href="http://www.adobe.com/products/photoshop-elements.html" target="_blank">http://www.adobe.com/products/photoshop-elements.html</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/iconify_icon1.png"><img class="alignnone size-full wp-image-1108" title="iconify_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/iconify_icon1.png" alt="" width="191" height="184" /></a></td>
<td>iConify is a very simple little app that fills a gap Apple should&#8217;ve taken care in another way &#8230; but anyhow &#8211; you drop a 520px icon on iConify&#8217;s window and iConify produces all the sizes and filenames you need to bundle with your app. There you go &#8211; it&#8217;s that simple.</p>
<p>iConify at the App Store for Free: <a title="iConify" href="http://itunes.apple.com/app/iconify/id416289784?mt=12" target="_blank">http://itunes.apple.com/app/iconify/id416289784?mt=12</a></td>
</tr>
</tbody>
</table>
<h2>Game creation power tools</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/particle_icon.png"><img class="alignnone size-full wp-image-1109" title="particle_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/particle_icon.png" alt="" width="244" height="239" /></a></td>
<td>Not much to say about Particle Designer, eh? If you are building a game for iOS you&#8217;ll definitely need some cool effects (ok, if you&#8217;re building a cool game for iOS that is) &#8211; you can do everything with particles &#8211; rain, fire, stars, vortexes, explosions, fountains, etc. etc. If you don&#8217;t have Particle Designer you&#8217;re in for a tough ride.</p>
<p>You can get Particle Designer for ONLY $7.99 + see a short tutorial at 71Squared&#8217;s web site:</p>
<p><a title="Particle Designer" href="http://particledesigner.71squared.com/" target="_blank">http://particledesigner.71squared.com/</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/tp_icon.png"><img class="alignnone size-full wp-image-1111" title="tp_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/tp_icon.png" alt="" width="195" height="175" /></a></td>
<td>There are few apps to manage textures and sprite sheets for your iOS games, but I think I like Texture Packer the most (having the widest variety of formats to export to) + is very snappy. If you&#8217;re building a game &#8211; sprite sheets are the answer, get Texture Packer for $24.95 from Andreas Loew:</p>
<p><a title="Texture Packer" href="http://www.touch-code-magazine.com/texturepacker" target="_blank">http://www.touch-code-magazine.com/texturepacker</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/pe_icon.png"><img class="alignnone size-full wp-image-1112" title="pe_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/pe_icon.png" alt="" width="193" height="175" /></a></td>
<td>Physics Editor helps you out defining shapes of your objects in your physics game. Very handy app, features a magic want to auto-detect the shapes of objects. Again from Andreas Loew for $19.95:</p>
<p><a title="Physics Editor" href="http://www.touch-code-magazine.com/physicseditor" target="_blank">http://www.touch-code-magazine.com/physicseditor</a></p>
<p>Or alternatively buy the Texture Packer + Physics Editor bundle for $34.95 (save $10):</p>
<p><a title="Bundle" href="http://www.touch-code-magazine.com/texturepacker_physicseditor_bundle" target="_blank">http://www.touch-code-magazine.com/texturepacker_physicseditor_bundle</a></td>
</tr>
</tbody>
</table>
<h2>Results</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/mr_icon.png"><img class="alignnone size-full wp-image-1113" title="mr_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/mr_icon.png" alt="" width="195" height="171" /></a></td>
<td>There&#8217;s no better software to tracking your success on the app store (or your competitor&#8217;s success for that matter) than MajicRank. This program is priceless in the first few days after launching when you are overexcited and want to know how your app is doing in real-time.</p>
<p>Get MajicRank free here:</p>
<p><a title="MajicRank" href="http://majicjungle.com/majicrank.html" target="_blank">http://majicjungle.com/majicrank.html</a></td>
</tr>
</tbody>
</table>
<h2>Various</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/en_icon.png"><img class="alignnone size-full wp-image-1114" title="en_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/en_icon.png" alt="" width="185" height="179" /></a></td>
<td>I resisted giving Evernote a try for a long long time, but when I finally surrendered it was magical &#8230; that&#8217;s a program which really serves you as your olde paper notebook, which you keep loosing and doesn&#8217;t have search &#8211; and better! It was very valuable while I was writing for &#8220;iOS5 by Tutorials&#8221; and when I work on different projects to keep my notes organized. The absolute best thing is you can just copy whatever from a web page and paste it inside a note, everything is transferred with the formatting and the images. I recommend a lot &#8211; it&#8217;s also FREE:</p>
<p><a title="Evernote" href="http://www.evernote.com/about/download/mac.php" target="_blank">http://www.evernote.com/about/download/mac.php</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/gp_icon.png"><img class="alignnone size-full wp-image-1115" title="gp_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/gp_icon.png" alt="" width="180" height="140" /></a></td>
<td>Grand Perspective is a fantastic little, but super-powerful tool. It helps you have a look at your hard drive from bird&#8217;s view and kind of really easy spot where you&#8217;re burning space. I just launched it today to spot an install of iPhone SDK 3.1.3 silently taking 3 Gigs of space on my drive &#8230; it&#8217;s erasing time for you buddy! So &#8230; Grand Perspective is free and very handy, give it a try:</p>
<p><a href="http://grandperspectiv.sourceforge.net/" target="_blank">http://grandperspectiv.sourceforge.net/</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/preview_icon.png"><img class="alignnone size-full wp-image-1116" title="preview_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/preview_icon.png" alt="" width="194" height="180" /></a></td>
<td>Yes, I actually also use a lot Preview &#8211; yes, the Preview that comes with your mac! If you haven&#8217;t noticed Preview also have a little toolbar which you can use to add shapes, highlights and text to the image you are previewing right now. It is super handy to just quickly open images, edit them and save right inside Preview. Try it <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/xampp_icon.png"><img class="alignnone size-full wp-image-1117" title="xampp_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/xampp_icon.png" alt="" width="164" height="167" /></a></td>
<td>XAMPP has been one of my favorite software bundles for years. XAMPP is a ready-to-use web server/ftp server/database server bundle (plus more inside), so that when you need to build web sites on your mac, you can have a real-life setup in less than 10 minutes.</p>
<p>I use it to run web server on my mac and work on different web sites on it, including developing web back-ends for some of my apps.</p>
<p>It&#8217;s free: <a title="XAMPP for MAC" href="http://www.apachefriends.org/en/xampp-macosx.html" target="_blank">http://www.apachefriends.org/en/xampp-macosx.html</a></td>
</tr>
</tbody>
</table>
<h2>Leisure time</h2>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/callofduty_icon.png"><img class="alignnone size-full wp-image-1118" title="callofduty_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/callofduty_icon.png" alt="" width="185" height="183" /></a></td>
<td>After a long day of coding, filing invoices or just plain zombifying debugging of a stupid problem &#8230; it&#8217;s really good &#8230; to .. just shoot some bad guys. I love the Call of Duty / Modern Warfare series, too bad they don&#8217;t release the new ones for Mac anymore &#8230; but hey, you can always play the first,second and fourth installments.</p>
<p>Here&#8217;s a link to Call of Duty 4 on the App Store at $26.99:</p>
<p><a title="Call of Duty 4 Download" href="http://itunes.apple.com/app/call-of-duty-4-modern-warfare/id403574981?mt=12" target="_blank">http://itunes.apple.com/app/call-of-duty-4-modern-warfare/id403574981?mt=12</a></td>
</tr>
</tbody>
</table>
<table style="margin-bottom: 20px;" width="550">
<tbody>
<tr>
<td width="190"><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/wog_icon.png"><img class="alignnone size-full wp-image-1119" title="wog_icon" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/12/wog_icon.png" alt="" width="187" height="169" /></a></td>
<td>World of Goo proves indie games can be fantastic just as much as AAA games. You probably have heard of World of Goo already (except if you have lived for the last 5 years in a cave on the moon without a telescope), but if you haven&#8217;t tried it (or if you have played it without paying for it, bad! these are indie guys like you and me!) &#8211; now is your chance to grab a copy from the App Store at $9.99:</p>
<p><a title="World of Goo" href="http://itunes.apple.com/app/world-of-goo/id414154107?mt=12" target="_blank">http://itunes.apple.com/app/world-of-goo/id414154107?mt=12</a></td>
</tr>
</tbody>
</table>
<h2>Wrap up</h2>
<p>Also I wanted to wish everyone Merry Christmas, and for those of you who don&#8217;t celebrate Christmas &#8211; enjoy the winter and making snowmen <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also &#8211; Christmas time is the perfect time to think about the less fortunate than you &#8211; did you know 1 of 8 people <strong>don&#8217;t have access to drinking water </strong>? Have a look here: <a title="Charity Water" href="http://www.charitywater.org/" target="_blank">http://www.charitywater.org/</a> you can help any time of the year!</p>
<p>And finally &#8211; thanks to my co-authors on &#8220;<a title="iOS5 by Tutorials" href="http://www.touch-code-magazine.com/iOS5ByTutorials" target="_blank">iOS5 by Tutorials</a>&#8220;, thanks to my colleagues on <a href="http://www.raywenderlich.com/" target="_blank">raywenderlich.com</a>, to Ray, to all the people who downloaded my apps and to you the readers of Touch Code Magazine for a fantastic 2011!</p>
<p>cheers, Marin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/software-that-completes-me-as-an-ios-developerpublisher/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Success Story on the App Store and beyond</title>
		<link>http://www.touch-code-magazine.com/success-story-on-the-app-store-and-beyond/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=success-story-on-the-app-store-and-beyond</link>
		<comments>http://www.touch-code-magazine.com/success-story-on-the-app-store-and-beyond/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 11:50:52 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[success]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1086</guid>
		<description><![CDATA[If you think success has a universal definition &#8211; get this &#8211; you are wrong. Everyone wants something different, therefore &#8220;success&#8221; &#8211; it&#8217;s a personal thing. In this post I&#8217;ll tell you the story of the last year and why I consider it being a success; luckily the App Store plays a big role in [...]]]></description>
			<content:encoded><![CDATA[<p>If you think success has a universal definition &#8211; get this &#8211; <strong>you are wrong</strong>. Everyone wants something different, therefore &#8220;success&#8221; &#8211; it&#8217;s a personal thing.</p>
<p>In this post I&#8217;ll tell you the story of the last year and why I consider it being a success; luckily the App Store plays a big role in this story and I can&#8217;t be more happier.</p>
<h2>1 year ago</h2>
<div>September 2010 <a title="A personal message" href="http://www.touch-code-magazine.com/a-personal-message/" target="_blank">I left my job</a> in Berlin, Germany &#8211; I was disappointed by it to a degree that without any plans for the future I just didn&#8217;t want to look for another job, but do something else instead of being an employee. Further &#8211; at the time I was destroyed both physically and mentally, way too many trouble on my head back then. I had worked very hard for a long time and together with couple of friends we have released &#8220;<a title="Pimpy App Store" href="http://itunes.apple.com/app/pimpy/id373809022?mt=8" target="_blank">Pimpy</a>&#8221; to the App Store just to find out sales were low, people enjoyed the app, but many of them didn&#8217;t get what it can do; and also some people cracked it quite fast and spread it around torrent web sites.</div>
<p>So … what happened after that and changed things so much?</p>
<h2><span id="more-1086"></span>Moving and changing mindset</h2>
<p>As I didn&#8217;t really find anything to keep me in Berlin I decided to move back to my home country Bulgaria and have time off until I figure what to do. It was definitely a wild move as back in Bulgaria standard of life is much lower and I haven&#8217;t been back there for a while, but in the end I decided to go for it.</p>
<p>So with a bit clearer head, back in Bulgaria I did the following in late Autumn 2010:</p>
<div>
<ul>
<li>secured a web dev contract and put some extra effort into it, which resulted in a long-term still going engagement, which brings in cash regularly</li>
<li>found a new place to live in a nice city and did set it up in a way I can live good and have place to work at</li>
<li>invited all my friends from around the country to visit me any time they find fit</li>
<li>got together with a friend who is a painter and designer and decided to put serious effort into iOS development</li>
</ul>
</div>
<div>We focused on developing a new app called &#8220;<a title="Doodle Booth App Store" href="http://itunes.apple.com/app/doodle-booth/id403497940?mt=8" target="_blank">Doodle Booth</a>&#8221; and released it in January 2011. I put many long nights in dramatically improving the UI and included some crack protection, and finally I <a title="Doodle Booth Touch Code Magazine" href="http://www.touch-code-magazine.com/new-app-doodle-booth-for-iphone-ipod/" target="_blank">changed the business model</a> compared to &#8220;Pimpy&#8221;. In its first day on the App Store the app was downloaded more than 7K times (it was a free app) grossing to 20K+ in the first week. It had horrible reviews, but even more people were happy with it and we saw a lot of conversions to the paid upgrade (as an in-app purchase).</div>
<div>So, lesson learned &#8211; <em>don&#8217;t give up and make a much better product instead</em>.</div>
<div>Much excited with the small success, we released quickly another similar app, but on a different topic &#8220;Blood Booth&#8221; which didn&#8217;t do so good, but also brought in some cash. Eventually we decided to make &#8220;<a title="Doodle Booth HD App Store" href="http://itunes.apple.com/app/doodle-booth-hd/id424600440?mt=8" target="_blank">Doodle Booth HD</a>&#8221; and &#8220;<a title="Doodle Booth HD Free App Store" href="http://itunes.apple.com/app/doodle-booth-hd-free/id433798108?mt=8" target="_blank">Doodle Booth HD Free</a>&#8221; for the iPad &#8211; they also scored pretty well on the much smaller iPad market.</div>
<p>All of these apps I&#8217;m mentioning were featured in one way or the other by Apple(also all other apps till the end of the post). They appeared in various countries as &#8220;New and Noteworthy&#8221; and &#8220;What&#8217;s hot&#8221;. How did I do that you might ask? I did put everything I had in those apps, and … Apple is apparently following what&#8217;s coming out and taking relevant decisions on featuring.</p>
<p>Meanwhile I have started to work seriously on using Cocos2d &#8211; I have released &#8220;<a title="Match Kana 2 App Store" href="http://itunes.apple.com/app/match-kana-2/id475225797?mt=8" target="_blank">Match Kana</a>&#8220;, which is an educational game to help Japanese learners. It does never see too many downloads, but I&#8217;m sure the target group is way too small; anyhow I was happy there was something out there built with Cocos2d.</p>
<p>Synthesized like that this could surely sound like a lot of work. But actually I had maybe 50/50 split on party and work. So pretty good! When you don&#8217;t go to an office you work only at the times you&#8217;re most productive, and you enjoy better results and faster turnaround times, while having tons of time for your friends and family. In 2011 I was 8 times in vacation &#8211; 7 of them to international destinations. (I actually cancelled nr.9 because I can&#8217;t find anyone anymore to come with me &#8211; my friends are out of vacation days and money, lol)</p>
<h2>Going beyond the App Store</h2>
<div>Late summer 2011 Udemy contacted me and asked me to create a video course on their web-site. I honestly didn&#8217;t know a thing about them, so I said why not and created a short Cocos2D 101 video course. Introduction of the Cocos2d basics to the Udemy platform out. Without having any expectation at all, I was pleased to see lot of people purchasing and enjoying it. It has more than 1,000 subscribers up to now and growing. Here&#8217;s part of a message a subscriber once sent me &#8220;<em>Many thanks Marin <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If you are planning to do a &#8220;level two&#8221; course count me in</em>&#8221; &#8211; it&#8217;s very rewarding to get such messages I tells ya.</div>
<p>So … even if I had absolutely no success with trying to publish edu materials in the past, I didn&#8217;t give up and just made a much better product. And it paid out.</p>
<p>About that time Ray (from <a title="Ray Wenderlich" href="http://www.raywenderlich.com" target="_blank">raywenderlich.com</a>) asked on his blog for people who&#8217;d like to write iOS tutorials for him. I have had bad experience with trying to write for different blogs in the past (people don&#8217;t follow through, discard ideas, etc) but I said why not? I&#8217;ll just write better than ever. And it wasn&#8217;t easy &#8211; in between creating the video course, releasing a game on the App Store and vacations in Malta and Germany, I also put extra effort into <a title="Marin Todorov tutorials" href="http://www.raywenderlich.com/?s=Marin+Todorov" target="_blank">writing great tutorials for Ray</a>. And it paid out &#8211; awesome feedback for my posts and lots of incoming traffic to my own site.</p>
<p>And it still wasn&#8217;t much work! I concentrated few day periods of non-stop work and then went into week long partying or travel!</p>
<h2>Making a ripple in the continuum</h2>
<div>Then … came an invite from Ray to co-author an iOS5 book with him and other guys from the tutorial team. (Should I mention anymore that I had unpleasant experience before? Just assume it from now on) It had to be pulled off in a record time and to tell you the truth the documentation on iOS5 at that time was quite sparse. But we did it &#8211; on the 12th of October, couple of hours after Apple lifted the NDA our <a title="iOS5 by Tutorials" href="http://www.touch-code-magazine.com/the-most-extensive-book-on-ios5-yet-ios5-by-tutorials/" target="_blank">book was on sale</a>. And it did (and does) awesome and the feedback is just fantastic. This book really feels like I left something meaningful out there.</div>
<p>Meanwhile I released a game called &#8220;<a title="Pew! Pew! Starblast" href="http://itunes.apple.com/app/pew-pew-starblast/id483375286?mt=8" target="_blank">Pew! Pew! Starblast</a>&#8221; which did horrible and saw about 7 sales (ha, I finally experienced what so many people in the iOS community are talking about) and right after the book was out &#8211; &#8220;<a title="Fun Photo Booth App Store" href="http://itunes.apple.com/app/xmas-fun-photo-booth/id476091621?mt=8" target="_blank">Fun Photo Booth</a>&#8221; a new photo app. &#8220;Fun Photo Booth&#8221; is doing decent on the App Store and shortly after I released also a small free app called &#8220;<a title="Perpetual Calendar App Store" href="http://itunes.apple.com/app/perpetual-calendar/id465686765?mt=8" target="_blank">Perpetual Calendar</a>&#8220;. Yeah, I should admit my designer friend is a machine, he draws better and faster than anyone I know.</p>
<h2>So … why is this a success story?</h2>
<div>I am stress free, travel regularly in vacation, financially stable and, I can work only on things I like and at my own pace. This is success to me. If it wasn&#8217;t for the App Store probably not much of this would&#8217;ve happened. But it did.</div>
<div>Lot of people when hear success would imagine a yacht, Bentley, and dumping dollar bills in the toilet. Just spend some time and think whether this would really make you happy? Define success for yourself and aim for it.</div>
<h2>And next?</h2>
<div>I&#8217;ve had my time off in Bulgaria and it&#8217;s been quite enough to change my mindset, and to make me enough self-confident and relaxed. (Also music is a disaster in here, so I need to go) I&#8217;m moving again to work on a contract in Berlin for a year. I have few long term clients, which I enjoy working with.</div>
<div>Also have 5 half finished Apps waiting their day. Working right now on another big product and I hope it will have success.</div>
<p>Future is bright &#8211; just don&#8217;t give up and do <strong>much better</strong> every next time.</p>
<div>Marin</div>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/success-story-on-the-app-store-and-beyond/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Cocos2d and ARC</title>
		<link>http://www.touch-code-magazine.com/cocos2d-and-arc/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cocos2d-and-arc</link>
		<comments>http://www.touch-code-magazine.com/cocos2d-and-arc/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 08:54:04 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Answers]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[ARC]]></category>
		<category><![CDATA[ios5]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1079</guid>
		<description><![CDATA[The ARC compatibility has already been merged in the latest branch of cocos2d &#8211; the 2.0 beta. And that&#8217;s great of course However &#8220;ARC compatible&#8221; turns out to be a broad definition. To use cocos2d in an ARC project (cocos2d being ARC compatible) you still have to disable ARC for cocos2d. Yup just like in [...]]]></description>
			<content:encoded><![CDATA[<p>The ARC compatibility has already been merged in the latest branch of cocos2d &#8211; the 2.0 beta. And that&#8217;s great of course <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>However &#8220;ARC compatible&#8221; turns out to be a broad definition. To use cocos2d in an ARC project (cocos2d being ARC compatible) you still have to disable ARC for cocos2d. Yup just like in the previous major version. And it&#8217;ll still not compile, but you have to do couple of tweaks in the code to get it running. Pity in the end &#8211; but hey we get the awesome cocos2d for free, so whatever comes it&#8217;s all good!</p>
<p>I actually ported a big cocos2d project to ARC last week using the <strong>1.1 branch of Cocos2d</strong> and it was an okay process (EDIT: btw I looked into using 2.0 beta and ARC and it seems to have some issues), took several hours but most of the time I spend in cleaning up my own code (quite big project) for ARC (mostly removing autoreleases and casting delegates to <em>id </em>). So it&#8217;s not scary if you have the extra time  - converting to ARC is embracing the future <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-1079"></span></p>
<p>However cocos2d <strong>actually</strong> being ARC compatible would&#8217;ve been great &#8230;</p>
<p>With that said, here&#8217;s few links to help you out <em>converting your game to ARC</em></p>
<p>1) Here&#8217;s Riq&#8217;s notes on the ARC compatibility:</p>
<p><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:2_0_0#new_features_improvements" target="_blank">http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:2_0_0#new_features_improvements</a></p>
<p>2) Here&#8217;s the instructions (now official as recommended by Riq) how to change cocos2d to run with your ARC project:</p>
<p><a href="http://www.tinytimgames.com/2011/07/22/cocos2d-and-arc/" target="_blank">http://www.tinytimgames.com/2011/07/22/cocos2d-and-arc/</a></p>
<p>3) Here&#8217;s a list of what I myself did encounter during converting my game to ARC:</p>
<ul>
<li>all <em>autorelease</em> calls should go</li>
<li>Box2D &#8211; setting the body&#8217;s sprite should get a cast like:</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">b2BodyDef carBodyDef; 
carBodyDef.userData <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>__bridge <span style="color: #a61390;">void</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>carSprite;</pre></div></div>

<ul>
<li>your custom dealloc will still get called, but &#8230; you cannot call <em>[super dealloc]</em> inside it</li>
<li>oh yeah, no properties&#8217; names should start with&#8221;<em>new</em>&#8221; &#8230; that felt stupid as I had a property &#8220;newDirection&#8221; and spent good few minutes to come up with a new name for it, which afterwards felt out of place for ever</li>
<li><em>atomic properties</em> cannot have custom getter/setter methods- just make them non-atomic and no need to change in the code</li>
<li>if you&#8217;re assigning your class as a delegate often you&#8217;ll have to cast it to (id)</li>
<li>there&#8217;s of course more &#8230; but I think these were the most common in my project, so good luck <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>cheers, Marin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/cocos2d-and-arc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Add an iCloud photo gallery to your app with MTICloudPhotoGallery library</title>
		<link>http://www.touch-code-magazine.com/add-an-icloud-photo-gallery-to-your-app-with-mticloudphotogallery-library/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=add-an-icloud-photo-gallery-to-your-app-with-mticloudphotogallery-library</link>
		<comments>http://www.touch-code-magazine.com/add-an-icloud-photo-gallery-to-your-app-with-mticloudphotogallery-library/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 12:49:12 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[iCloud]]></category>
		<category><![CDATA[ios5]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[photo gallery]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1058</guid>
		<description><![CDATA[As I previously mentioned on TCM I wrote a nice little library to add photo publishing to iCloud last month when I was finishing &#8220;Fun Photo Booth&#8221;. Thanks to the chapter &#8220;Beginning iCloud&#8221; in &#8220;iOS 5 by Tutorials&#8221; by my co-author Cesare it was quite easy to enable iCloud support, but of course there were [...]]]></description>
			<content:encoded><![CDATA[<p>As I previously mentioned on TCM I wrote a nice little library to add photo publishing to iCloud last month when I was finishing &#8220;Fun Photo Booth&#8221;. Thanks to the chapter &#8220;Beginning iCloud&#8221; in &#8220;iOS 5 by Tutorials&#8221; by my co-author Cesare it was quite easy to enable iCloud support, but of course there were also some quirks to work on. As this is also my first post for iDevBlogADay I thought it&#8217;d be nice if I package the iCloud library and provide it freely as a download and also walk you through how to use it in your own app.</p>
<h2>Library structure</h2>
<p>There are 3 different tiers in the library and you can choose which one to use depending on how much customization you need. If you use the top tier only you can add opening and saving images from iCloud with just about 10 lines of Objective-C code (which is always cool). Then you can decided to use the lower level classes also and you can further customize everything from the look to the code itself. Let&#8217;s have a look:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_dia.png"><img class="alignnone size-full wp-image-1059" title="icloud_dia" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_dia.png" alt="" width="542" height="399" /></a></p>
<p>At the top you have 2 classes : <em>MTICloudOpenImageButton</em> and <em>MTCloudSaveImageButton</em> &#8211; these two classes inherit UIButton and are drop in UI elements you can just add to your interface and have ready interaction with iCloud. In the middle tier you have <em>MTICloudImagesController</em> &#8211; this is the controller class you can call to open and save images to iCloud and to check for iCloud availability. At the very bottom you have <em>MTICloudFileOpenViewController</em> &#8211; this is a UIViewController class which you can present modally to show the user the images saved to their iCloud.</p>
<p>So as you can see it all goes from top to bottom and you can just plug your code whenever you want in the chain. I&#8217;ll show you examples how to use all of the classes.</p>
<h2><span id="more-1058"></span>Enabling your app for iCloud</h2>
<p>So to build and test an application enabled for iCloud you&#8217;ll need to have an Apple iOS Developer Account and a test device. iCloud is not enabled on the Simulator, so you won&#8217;t be able to follow through if you don&#8217;t have a developer account. So provided you do, follow this link to an excellent iCloud tutorial by Cesare and scroll down to the &#8220;Enabling iCloud in your app&#8221; section. Follow the instructions on how to create an iCloud enabled App Bundle ID and when you finish with the setup continue with &#8220;Using the ready iCloud buttons&#8221; section below.</p>
<p><a title="Beginning iCloud" href="http://www.raywenderlich.com/6015/beginning-icloud-in-ios-5-tutorial-part-1" target="_blank">&#8220;Enabling iCloud in your app&#8221; by Cesare</a></p>
<h2>Using the ready iCloud buttons</h2>
<p>First showcase will be using the ready made iCloud buttons. Download the demo application for this article and we&#8217;ll go through the code to oversee the whole process: <a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/iCloudPhotoGalleryDemo.zip">Demo App</a>.</p>
<p>Now&#8230; we need to do one thing before going to the code. If you followed correctly Cesare&#8217;s instructions you have created a new iCloud enabled Bundle App ID. Copy this ID and open the &#8220;iCloudPhotoGallery-Info.plist&#8221; in the demo app. Find the row saying &#8220;Bundle Identifier&#8221; and replace the value on the right with your own Bundle ID. Done.</p>
<p>Inside the view controller&#8217;s header file &#8220;<em>MTViewController.h</em>&#8221; you&#8217;ll see the import that adds the library to the class (this is a one-shot include, it just imports all the classes):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;MTICloudImages.h&quot;</span></pre></div></div>

<p>and also two protocols to the class definition:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&amp;</span>lt;UIImagePickerControllerDelegate, MTICloudImagesControllerSaveDelegate<span style="color: #002200;">&amp;</span>gt;</pre></div></div>

<p>the first you probably know &#8211; handles the camera view controller events and the second protocol defines the methods necessary to handle saving an image to iCloud (defined by my library&#8217;s protocol, look it up).</p>
<p>Open up the implementation file. Inside viewDidLoad is all the code needed to add the buttons for opening and saving images to iCloud. The open image button:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>
  <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MTICloudOpenImageButton buttonAtPosition<span style="color: #002200;">:</span> CGPointMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">150</span>, <span style="color: #2400d9;">150</span><span style="color: #002200;">&#41;</span> withBlock<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span>image, <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">//code to handle the image from iCloud</span>
    loadImageView.image <span style="color: #002200;">=</span> image;
  <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span> animate<span style="color: #002200;">&#93;</span>
<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>As you see creating the open image button is pretty simple &#8211; you supply it a position and a block to handle the selected image. In the case of the demo app the selected image is loaded up in a UIImageView. If image is nil &#8211; it means the user cancelled the open dialogue, and if error is different than nil than of course there has been some kind of error.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>
  <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MTICloudSaveImageButton buttonAtPosition<span style="color: #002200;">:</span> CGPointMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">150</span>, <span style="color: #2400d9;">380</span><span style="color: #002200;">&#41;</span> withBlock<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">//code</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>error<span style="color: #002200;">==</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; saveImageView.image<span style="color: #002200;">!=</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
     <span style="color: #11740a; font-style: italic;">//save to iCloud</span>
       <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MTICloudImagesController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> saveImage<span style="color: #002200;">:</span> saveImageView.image withDelegate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>self<span style="color: #002200;">&#93;</span>;
     <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span> animate<span style="color: #002200;">&#93;</span>
  <span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Saving an image to iCloud is similar &#8211; we add the button to the view and when tapped we call saveImage:withDelagate: to save the image to iCloud. You can skim down the code which is pretty standard and handles taking photos with the camera. At the very bottom you will find the method required by the MTICloudImagesControllerSaveDelegate protocol: -(void)savedToICloud:(NSError*)error. It just shows a message in the demo app, but you can implement your own logic in your app.</p>
<p>That&#8217;s about all the code you need! Connect an iPhone or an iPod to your computer and run the project on the device. Here&#8217;s how the app screen looks like:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_demoapp.png"><img class="alignnone size-full wp-image-1060" title="icloud_demoapp" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_demoapp.png" alt="" width="320" height="480" /></a></p>
<p>Note how the buttons flow a bit &#8211; this is because I&#8217;m calling the -(void)animate method when I add them to the view. You can omit that if you don&#8217;t like the floating effect.</p>
<p>Press &#8220;Take photo&#8221; and make a photo with the device&#8217;s camera. You will see the photo load up:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_save1.png"><img class="alignnone size-full wp-image-1061" title="icloud_save1" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_save1.png" alt="" width="320" height="202" /></a></p>
<p>Now press the floating save button to save the image to iCloud.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_save2.png"><img class="alignnone size-full wp-image-1062" title="icloud_save2" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_save2.png" alt="" width="320" height="200" /></a></p>
<p>Now let&#8217;s check if the image was saved &#8211; tap &#8220;open an image from your iCloud&#8221; and you will see the photo gallery browser (like in the screenshot below, but showing only the image you just saved):</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_open.png"><img class="alignnone size-full wp-image-1063" title="icloud_open" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_open.png" alt="" width="320" height="480" /></a></p>
<p>You can tap a photo to load it up in the app:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_open2.png"><img class="alignnone size-full wp-image-1064" title="icloud_open2" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_open2.png" alt="" width="320" height="233" /></a></p>
<p>You can also swipe right over an item in the list to delete the photo from your iCloud account:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_delete.png"><img class="alignnone size-full wp-image-1065" title="icloud_delete" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/icloud_delete.png" alt="" width="320" height="191" /></a></p>
<p>Cool? Yeah <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  You can browse inside the library sources and you can just replace the button images to have your own buttons. You can create your own iCloud buttons if you follow this cool and easy tutorial: <a href="http://rendrart.com/view/create-the-apple-icloud-logo/" target="_blank">Create the Apple iCloud logo</a></p>
<p>Or alternatively if you don&#8217;t want the buttons at all go a level lower and do calls directly to MTICloudImagesController:</p>
<h2>Using MTICloudImagesController</h2>
<p>First you need to know how to check whether iCloud is enabled on the user&#8217;s device:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>MTICloudImagesController isICloudEnabled<span style="color: #002200;">&#93;</span><span style="color: #002200;">==</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
  <span style="color: #4000c0;">NSLog</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;iCloud is NOT enabled, do something here ...&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>To invoke the open image dialogue:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MTICloudImagesController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> openImageWithBlock<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span>image, <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
  <span style="color: #11740a; font-style: italic;">//image opened</span>
  <span style="color: #4000c0;">NSLog</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;image selected: %@&quot;</span>, image<span style="color: #002200;">&#41;</span>;
  <span style="color: #002200;">&#125;</span> inViewController<span style="color: #002200;">:</span> self<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Note you need to pass a view controller which will present the open image dialogue.</p>
<p>And to save the image to iCloud (exactly as above with the button example):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MTICloudImagesController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> saveImage<span style="color: #002200;">:</span> myImage withDelegate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>self<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>And you&#8217;ll need to implement -(void)savedToICloud:(NSError*)error on the delegate.</p>
<h2>Using the open dialogue only</h2>
<p>Finally if you don&#8217;t want to use the controller class but you still like the image browser dialogue, you can just present it yourself. Just make an instance of <em>MTICloudFileOpenViewController</em> and set its <em>openDelegate</em> property to your delegate class (also it must implement the <em>MTICloudFileOpenViewControllerDelegate</em> protocol). If you choose for this option, please be aware that the dialogue lists all files ending with &#8220;_thumb.png&#8221; their file names. When the user selects an images, the dialogue loads a file with the same name but lacking &#8220;_thumb&#8221; and this is the image that it sends back to its delegate.</p>
<h2>Wrap-up</h2>
<p>I hope you enjoyed the post and the iCloud photo gallery library will be useful in your apps. Even if not using it as a drop-in you can just browse around the code and quick-start your own iCloud stuff.</p>
<p>Here&#8217;s a link to the source code of the library &#8211; feel free to use any way you want: <a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/iOS5_iCloud_PhotoGallery_src.zip">Source Code</a> and again the <a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/iCloudPhotoGalleryDemo.zip">Demo App</a> project</p>
<p>cheers, Marin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/add-an-icloud-photo-gallery-to-your-app-with-mticloudphotogallery-library/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone SDK and Objective-C for absolute beginners</title>
		<link>http://www.touch-code-magazine.com/iphone-sdk-and-objective-c-for-absolute-beginners/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=iphone-sdk-and-objective-c-for-absolute-beginners</link>
		<comments>http://www.touch-code-magazine.com/iphone-sdk-and-objective-c-for-absolute-beginners/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 22:17:34 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[apprentice]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[e-book]]></category>
		<category><![CDATA[epic]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[matthijs hollemans]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[turorial]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1044</guid>
		<description><![CDATA[From many comments by readers on Touch Code Magazine I get the impression quite few of you are absolute beginners to the iOS platform. And that makes total sense - the iPhone and iPad are the hottest mobile products out there and of course everyone wants a piece of them (me included).

So ... for everyone who are beginners in iOS (no matter if you have previous programming experience) I'd like to talk to you shortly about a series of e-books created by a great person: Matthijs Hollemans. Matthijs is a very experienced iPhone developer, we're both members of the original Ray Wenderlich's iOS Tutorial Team and we both co-authored the "iOS5 by Tutorials" book. For those of you who are just starting with iPhone development and feel a bit lost - he has created a great product]]></description>
			<content:encoded><![CDATA[<p>From many comments by readers on Touch Code Magazine I get the impression quite few of you are absolute beginners to the iOS platform. And that makes total sense &#8211; the iPhone and iPad are the hottest mobile products out there and of course everyone wants a piece of them (me included).</p>
<p>When I started with Objective-C just a bit more than 2 years ago I remember it was quite hard to pick up &#8211; it was quite different than any other platform I worked with (and at the time I was already doing programming for 17 years). What I see quite a lot these days is many people try to start with iOS by just asking loads of questions in StackOverflow and copying and pasting code they&#8217;d find around blogs. And that&#8217;s great &#8211; but here&#8217;s what I really think: you need a solid understanding of the basics to be able to build a good app.</p>
<p>So &#8230; for everyone who are beginners in iOS (no matter if you have previous programming experience) I&#8217;d like to talk to you shortly about a series of e-books created by a great person: <strong>Matthijs Hollemans</strong>. Matthijs is a very experienced iPhone developer, we&#8217;re both members of the original Ray Wenderlich&#8217;s iOS Tutorial Team and we both co-authored the &#8220;iOS5 by Tutorials&#8221; book. For those of you who are just starting with iPhone development and feel a bit lost &#8211; he has created a great product; let&#8217;s have a look:<span id="more-1044"></span></p>
<h2>The iOS Apprentice Series</h2>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Preview1.png"><img class="alignnone size-full wp-image-1045" title="Preview1" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Preview1.png" alt="" width="550" height="342" /></a></p>
<p>The &#8220;iOS Apprentice&#8221; is series of e-books which guide you through the whole process of setting up iOS development environment and creating your first few applications.</p>
<p>When you go through all the material you will know pretty much all the basics of Objective-C and iOS development:</p>
<ul>
<li>downloading and installing Xcode &#8211; the iOS development IDE</li>
<li>understanding the Xcode&#8217;s layout and components</li>
<li>Objective-C language structures and functions</li>
<li>the app components &#8211; icons, startup screens, code and assets</li>
<li>basic code troubleshooting</li>
<li>common application components &#8211; buttons, sliders, images, tables and more</li>
<li>using Interface Builder to design the application&#8217;s layout</li>
<li>testing your application on an iOS device &#8211; an iPod, iPhone or an iPad</li>
<li>and much much more &#8230;</li>
</ul>
<p>It looks like a long list &#8211; but believe me there&#8217;s even more covered in the &#8220;iOS Apprentice&#8221;. Matthijs expects you to have <strong>zero</strong> knowledge and gets you to successfully program in Objective-C and build iOS apps. I don&#8217;t say you&#8217;ll learn fast and easily. On the contrary &#8211; it might take you quite some time &#8211; if you read carefully through, enter the code and do the exercises, well &#8230; it&#8217;ll take you some time, but it&#8217;ll be well worth it.</p>
<p>There&#8217;s three part in the series. The first one &#8220;<strong>Getting Started</strong>&#8221; takes you through the basics &#8211; installing Xcode, getting around and building a UIKit game.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/XcodeLayout.jpg"><img class="alignnone size-full wp-image-1046" title="XcodeLayout" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/XcodeLayout.jpg" alt="" width="550" height="270" /></a></p>
<p>You will also develop the game &#8220;Bull&#8217;s eye&#8221; &#8211; the idea behind the game is very cool and you&#8217;ll actually learn quite a lot following through the tutorial.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/BullsEye.jpg"><img class="alignnone size-full wp-image-1051" title="BullsEye" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/BullsEye.jpg" alt="" width="550" height="355" /></a></p>
<p>What I really like in this chapter is that you first build a prototype with a vanilla interface and then you make it cool:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Prototyping.png"><img class="alignnone size-full wp-image-1047" title="Prototyping" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Prototyping.png" alt="" width="499" height="144" /></a></p>
<p>The second chapter is called &#8220;<strong>Checklists</strong>&#8221; and it&#8217;s a two part tutorial which deepens your UIKit knowledge, presents you to Storyboarding (new to iOS5) and will all in all get you a solid understanding of building app workflow.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/CheckLists.jpg"><img class="alignnone size-full wp-image-1048" title="CheckLists" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/CheckLists.jpg" alt="" width="550" height="345" /></a></p>
<p>The third and last (for the moment) part is &#8220;<strong>My Locations</strong>&#8221; and it introduces you to one of the most interesting iOS frameworks &#8211; Core Location. You will build a location aware application and further extend your Objective-C and UIKit knowledge.</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Locations.png"><img class="alignnone size-full wp-image-1050" title="Locations" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Locations.png" alt="" width="550" height="349" /></a></p>
<p>It&#8217;s definitely hard to introduce an epic work like the &#8220;iOS Apprentice&#8221; in a short article like this, but I&#8217;d say only that: I would&#8217;ve been really happy if a product like this one existed when I was starting with Objective-C <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Back then app development wasn&#8217;t that hip and there were very few resources especially on Objective-C, and this was one of the reasons I started Touch Code Magazine &#8211; it was so hard to find any info that I wanted to put everything I find out about Obj-C and iPhone online for everyone else to have at hand too!</p>
<p>I&#8217;m really impressed with Matthijs&#8217; work on the &#8220;iOS Apprentice&#8221; and I highly recommend it to all beginners. The access to the three epic e-books in the series costs &#8220;39$&#8221; and you&#8217;ll get plenty of material for that price. If you follow the link below and do purchase it I&#8217;ll get a small commission for the sale if it&#8217;s all the same to you (price is the same for you; also you&#8217;re welcome to look the product up in Google)</p>
<h4><a title="iOS Apprentice by Matthijs Hollemans" href="http://e86c87o8rtt7jlaickrkhhjs5d.hop.clickbank.net/"><span style="color: #3366ff;"><span style="text-decoration: underline;">Learn more</span> about the &#8220;iOS Apprentice&#8221; e-books and optionally purchase it</span></a></h4>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/iphone-sdk-and-objective-c-for-absolute-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fire, smoke and waterfalls with Particle Systems in iOS5</title>
		<link>http://www.touch-code-magazine.com/fire-smoke-and-waterfalls-with-particle-systems-in-ios5/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=fire-smoke-and-waterfalls-with-particle-systems-in-ios5</link>
		<comments>http://www.touch-code-magazine.com/fire-smoke-and-waterfalls-with-particle-systems-in-ios5/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 10:34:18 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[ios5]]></category>
		<category><![CDATA[iOS5 by Tutorials]]></category>
		<category><![CDATA[Particle Systems]]></category>
		<category><![CDATA[Particles]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[uikit]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1038</guid>
		<description><![CDATA[You’ve probably seen particle systems used in many different iOS apps and games for explosions, fire effects, rain or snow falling, and more. However, you probably saw these types of effects most often in games, because UIKit didn’t provide a built-in capability to create particle systems – until iOS 5, that is!

Now with iOS 5, you can use particle systems directly in UIKit to bring a lot of exciting new eye-candy to your apps. Here are a few examples of where particle systems could be useful...]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">You’ve probably seen particle systems used in many different iOS apps and games for explosions, fire effects, rain or snow falling, and more. However, you probably saw these types of effects most often in games, because UIKit didn’t provide a built-in capability to create particle systems – until iOS 5, that is!</div>
<div id="_mcePaste">Now with iOS 5, you can use particle systems directly in UIKit to bring a lot of exciting new eye-candy to your apps. Here are a few examples of where particle systems could be useful:<span id="more-1038"></span></div>
<div id="_mcePaste">
<ul>
<li><strong>UIKit games</strong>: Yes, you can make games with plain UIKit (and some types of games work really well there, particularly card games and the like). But now, you can make them even better with explosions, smoke, and other goodies!</li>
<li><strong>Slick UI effects</strong>: When your user moves around an object on the screen it can leave a trail of smoke, why not?</li>
<li><strong>Stunning screen transitions</strong>: How about presenting the next screen in your app while the previous one disappears in a ball of fire?</li>
</ul>
</div>
<p>One of my chapters in the &#8220;<a title="iOS5 by Tutorials" href="http://e86c87o8rtt7jlaickrkhhjs5d.hop.clickbank.net/">iOS5 by Tutorials</a>&#8221; book introduces you building Particle Systems with UIKit in iOS5 and this chapter was a part of the iOS Feast at Ray Wenderlich&#8217;s web site. So if you have missed this great tutorial, follow the link below and enjoy a quick and simple walk through to building a &#8220;Draw with fire&#8221; application for iOS and UIKit particle systems.</p>
<p><a href="http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial">UIKit Particle Systems in iOS 5 Tutorial</a> by Marin Todorov on raywenderlich.com</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Particles_Screen8.jpg"><img class="alignnone size-full wp-image-1039" title="Particles_Screen8" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Particles_Screen8.jpg" alt="" width="320" height="480" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/fire-smoke-and-waterfalls-with-particle-systems-in-ios5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun Photo Booth released &#8211; features iCloud, new Twitter UI, custom photo album (iOS5)</title>
		<link>http://www.touch-code-magazine.com/fun-photo-booth-released-features-icloud-new-twitter-ui-custom-album-ios5/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=fun-photo-booth-released-features-icloud-new-twitter-ui-custom-album-ios5</link>
		<comments>http://www.touch-code-magazine.com/fun-photo-booth-released-features-icloud-new-twitter-ui-custom-album-ios5/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 09:18:50 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[album]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[booth]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[iCloud]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[released]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=1001</guid>
		<description><![CDATA[So today my first app featuring iOS5 extras went live on the App Store. It's another iteration of the iOS photo editing engine I'm working on for 2 years now, wrapped up with a super nice new UI and released as an universal app running on your iPod, iPhone and iPad. Let's have a look at what iOS5 features it includes and my recommendation how to include them in your apps too]]></description>
			<content:encoded><![CDATA[<p>So today my first app featuring iOS5 extras went live on the App Store. It&#8217;s another iteration of the iOS photo editing engine I&#8217;m working on for 2 years now, wrapped up with a super nice new UI and released as an universal app running on your iPod, iPhone and iPad.</p>
<p>&#8220;<a href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2" target="_blank">Fun Photo Booth</a>&#8221; is a free download from the App Store, and high quality sharing to Facebook/Twitter/iCloud requires a $ upgrade.</p>
<p><a title="Fun Photo Booth" href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2"><img class="alignnone size-full wp-image-1003" title="FB_Screen_1" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/FB_Screen_1.jpg" alt="" width="320" height="480" /></a></p>
<p>I wanted to share a bit about what difficulties I encountered while upgrading the code for iOS5.</p>
<h2>Saving to camera roll and custom app photo albums</h2>
<p>So, iOS5 SDK has new APIs in the assets framework, which gives you the opportunity to add the photos your app creates to custom albums. It&#8217;s a pretty neat feature as with the booming photo app market the user want to have their photos organized by the software they have been created by. So, &#8220;Fun Photo Booth&#8221; saves all photos to a custom album called &#8220;Fun Booth photos&#8221;. That was kind of a challenge as I find the new assets framework APIs aren&#8217;t working smooth enough already.</p>
<p><a title="Fun Photo Booth" href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2"><img class="alignnone size-full wp-image-1004" title="FB_Albums" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/FB_Albums.png" alt="" width="320" height="480" /></a></p>
<p>If you would like to add this feature to your iOS app, you can have a look at <a href="http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/" target="_blank">this tutorial I wrote about it (it features also a free source code download)</a></p>
<h2>Integration with the new iOS5 Twitter UI</h2>
<p>Right now the app is compatible with iOS 5.0 and iOS 4.x, so I have a little runtime check for the iOS version and when the user is running iOS 5.0 and later when he/she wants to share their photo directly to Twitter they will see new slick iOS5 UI; and when they are still running 4.x they see our custom post to Twitter UI. It probably sounds like too much effort, but when there&#8217;s another couple of minor iteration of iOS5 I&#8217;ll just remove the code supporting 4.x and voila! Everyone&#8217;s happy.</p>
<p><a title="Fun Photo Booth" href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2"><img class="alignnone size-full wp-image-1005" title="IMG_0841" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/IMG_0841.jpg" alt="" width="320" height="480" /></a></p>
<p>If you want to learn more about the new Twitter integration in iOS5, you can first read through the excellent &#8220;<a href="http://www.raywenderlich.com/5519/beginning-twitter-in-ios-5" target="_blank">Beginning Twitter in iOS 5 Tutorial</a>&#8220;. It&#8217;s written by my co-author on &#8220;<em>iOS5 by Tutorials</em>&#8221; &#8211; <strong>Felipe Laso</strong>. It&#8217;s a very good tutorial to get you started, and if you want to learn more on Twitter or iOS5 in general you&#8217;re welcome to have a look at our book: &#8220;<a title="iOS5 by Tutorials" href="http://e86c87o8rtt7jlaickrkhhjs5d.hop.clickbank.net/" target="_blank">iOS5 by Tutorials</a>&#8221;</p>
<h2>Integration with iCloud</h2>
<p>Integrating iCloud within &#8220;Fun Photo Booth&#8221; was actually quite easy. iCloud being enabled that is &#8211; after that getting things to work as I want honestly wasn&#8217;t that easy <img src='http://www.touch-code-magazine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So basically what I wanted was to be able to store photos from Fun Photo Booth in the user&#8217;s iCloud space and being able to open them again later on. So if the user kinda has several devices and so on, he will be able to exchange photos, etc. etc.</p>
<p>The issue right there (after some testing) I realized was &#8211; each photo is few megabytes in size (depending on your device&#8217;s camera) and when there were 10 photos coming from iCloud this was taking quite a lot of time. I wanted to be able to instantly show a list with previews to the user, so he can choose which photo he wants to download.</p>
<p>First thing that came to my mind was to save file bundles from my app and those bundles would include a thumbnail and the full photo. After I browsed quickly through the NSFIleWrapper docs, it looked like you need to open the bundle and then you can extract single files, so that didn&#8217;t help me much. In the end I just made the app save separate files for the thumbnail and the full photo, so when user wants to open a file he is presented with the thumbnail previews (say 1K each) and if he wants to open a photo, then the full photo is loaded &#8230;</p>
<p><a title="Fun Photo Booth" href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2"><img class="alignnone size-full wp-image-1006" title="IMG_0838" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/IMG_0838.jpg" alt="" width="320" height="480" /></a></p>
<p>I bundled this iCloud image opener as a separate standalone view controller and I was wondering whether this would be an interesting topic to post about on Touch Code Magazine? Let me know guys, if you think it will be.</p>
<p>To get started yourselves with iCloud you can read through this excellent tutorial &#8220;<a href="http://www.raywenderlich.com/6015/beginning-icloud-in-ios-5-tutorial-part-1" target="_blank">Beginning iCloud in iOS 5</a>&#8220;. It is written by <strong>Cesare Rocchi</strong> &#8211; one of my co-authors on &#8220;<em>iOS5 by Tutorials</em>&#8221; &#8211; I guess there&#8217;s no need by now to mention again that if you want to read more from Cesare on iCloud and learn other new iOS5 APIs you should definitely lookup the &#8220;<a href="http://e86c87o8rtt7jlaickrkhhjs5d.hop.clickbank.net/" target="_blank">iOS5 by Tutorials</a>&#8221; book.</p>
<h2>Fun Photo Booth</h2>
<p>If I got you interested &#8211; <a title="Fun Photo Booth" href="http://itunes.apple.com/app/fun-photo-booth/id476091621?mt=8&amp;ign-mpt=uo%3D2">Fun Photo Booth</a> is a free download and I&#8217;d be glad to hear your feedback</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/fun-photo-booth-released-features-icloud-new-twitter-ui-custom-album-ios5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS5: Saving photos in custom photo album (+category for download)</title>
		<link>http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ios5-saving-photos-in-custom-photo-album-category-for-download</link>
		<comments>http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 08:00:47 +0000</pubDate>
		<dc:creator>Marin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[iOS5]]></category>
		<category><![CDATA[ALAsset]]></category>
		<category><![CDATA[ALAssetsLibrary]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[ios5]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[photo album]]></category>

		<guid isPermaLink="false">http://www.touch-code-magazine.com/?p=972</guid>
		<description><![CDATA[iOS5 features new APIs in the AssetsLibrary framework which give you the opportunity to manage your app's own photo album inside the user's photo library. That is a logical step from Apple since photo applications market is booming and users want to have their photos organized by the application they were created with. (I released 4 photo apps to date, 5th in review - so I have pretty good overview on photo apps)

I wanted to include a ALAssetsLibrary API chapter in "iOS5 by Tutorials" but I was experience problems with the assets framework until the very launch of iOS5 (and after) so I decided not to include such chapter in the book. It looks like the combination of the iCloud photo stream, Core Data managed photo library and 3rd party apps read/write access at the same time is giving Apple hard time - I'm looking forward to 5.0.1 to see if the problems would be fixed.

Without further ado - iOS5 allows you to create and delete albums in the user photo library and add pictures from the camera roll to those albums too. Let's have a look...]]></description>
			<content:encoded><![CDATA[<h2>Custom photo albums in iOS5</h2>
<p>iOS5 features new APIs in the AssetsLibrary framework which give you the opportunity to manage your app&#8217;s own photo album inside the user&#8217;s photo library. That is a logical step from Apple since photo applications market is booming and users want to have their photos organized by the application they were created with. (I released 4 photo apps to date, 5th in review &#8211; so I have pretty good overview on photo apps)</p>
<p>I wanted to include a ALAssetsLibrary API chapter in &#8220;<a title="iOS5 by Tutorials" href="http://e86c87o8rtt7jlaickrkhhjs5d.hop.clickbank.net/" target="_blank">iOS5 by Tutorials</a>&#8221; but I was experience problems with the assets framework until the very launch of iOS5 (and after) so I decided not to include such chapter in the book. It looks like the combination of the iCloud photo stream, Core Data managed photo library and 3rd party apps read/write access at the same time is giving Apple hard time &#8211; I&#8217;m looking forward to 5.0.1 to see if the problems would be fixed.</p>
<p>Without further ado &#8211; iOS5 allows you to create and delete albums in the user photo library and add pictures from the camera roll to those albums too. Let&#8217;s have a look.<span id="more-972"></span></p>
<h2>Custom photo album category for ALAssetsLibrary</h2>
<p>Unfortunately browsing through the new assets APIs you won&#8217;t find a single method, which will create or access your custom album and save an image inside. And honestly this is all I would need when creating a photo app &#8211; something easy to call and pass a UIImage to.</p>
<p>So while creating my latest app (Fun Photo Booth &#8211; to come out in the next days) I crafted a simple category add-on for ALAssetsLibrary and in this tutorial I&#8217;ll show you how to use for your own photo apps (free code download included of course)</p>
<p>The method we will use from the category is the following:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>saveImage<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIImage<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>image
         toAlbum<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>albumName
withCompletionBlock<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>SaveImageCompletion<span style="color: #002200;">&#41;</span>completionBlock;</pre></div></div>

<p>Easy peasy. Your app should create a UIImage by doing its special magic and will just need to pass it to this method along with the album name and a block to handle the end of the saving process. I think this should be as simple as it gets. Let&#8217;s see this in action by creating a simple project and use the category.</p>
<h2>Building a demo with own photo album</h2>
<p>Start by creating a single view project in Xcode &#8211; name it &#8220;CustomPhotoAlbumDemo&#8221;. Add the AssetsLibrary.framework to the project (I&#8217;m going quicker over these steps ok?) Download the <strong>ALAssetsLibrary+CustomPhotoAlbum</strong> code from here: <a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/ALAssetsLibrary_CustomPhotoAlbum.zip">ALAssetsLibrary_CustomPhotoAlbum.zip</a> and copy the 2 files for the category inside your Xcode project. Setup is done.</p>
<p>Now open up the XIB file in the project and setup a single button like so:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_1.png"><img class="alignnone size-full wp-image-975" title="Album_1" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_1.png" alt="" width="391" height="540" /></a></p>
<p>Open up your view controller header file and add this import at the top:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &amp;lt;AssetsLibrary/AssetsLibrary.h&amp;gt;</span></pre></div></div>

<p>and a property to keep hold of the assets library:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>strong, atomic<span style="color: #002200;">&#41;</span> ALAssetsLibrary<span style="color: #002200;">*</span> library;</pre></div></div>

<p>last you&#8217;ll need the class to be a UIImagePickerController delegate, so after &#8220;UIViewController&#8221; on the same line add:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&amp;</span>lt;UIImagePickerControllerDelegate<span style="color: #002200;">&amp;</span>gt;</pre></div></div>

<p>That should be about right. Open the implementation file now. Just below the @implementation line synthesize the library property:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@synthesize</span> library;</pre></div></div>

<p><strong>NB! </strong> When you work with ALAssetsLibrary it represents a snapshot of the assets on the device, i.e. if you have different instances of ALAssetsLibrary they may get out of sync, not to mention other horrible discrepancies, which seems to happen on iOS5. So, advice in Apple dev forums is &#8211; have a single instance of the library and make it a strong property, make sure you never loose it and work only with it. I find this advice immensely helpful, although it doesn&#8217;t really solve all problems, but does most</p>
<p>So, we have the library in a property &#8211; let&#8217;s also take care of initializing it. Lookup viewDidLoad and viewDidUnload and replace them with:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
    self.library <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>ALAssetsLibrary alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidUnload
<span style="color: #002200;">&#123;</span>
    self.library <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#91;</span>super viewDidUnload<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Few more steps and we&#8217;ll be ready with our photo app demo. I hope you are familiar with using the camera controller, as I won&#8217;t go into details. In short &#8211; you make an instance of a controller, which basically takes a photo for you and serves it back to a delegate of your choice. So add the method to take the photo:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span>takePhoto
<span style="color: #002200;">&#123;</span>
    UIImagePickerController <span style="color: #002200;">*</span>imagePickerController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImagePickerController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
    imagePickerController.sourceType <span style="color: #002200;">=</span> UIImagePickerControllerSourceTypeCamera;
	imagePickerController.editing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
    imagePickerController.delegate <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>self;
&nbsp;
    <span style="color: #002200;">&#91;</span>self presentModalViewController<span style="color: #002200;">:</span>imagePickerController animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>OK. Let&#8217;s connect the UI with the code. Open the XIB file again. While holding the &#8220;Ctrl&#8221; key drag with the mouse from the button to File&#8217;s Owner and from the popup menu choose &#8220;takePhoto&#8221;:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_2.png"><img class="alignnone size-full wp-image-976" title="Album_2" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_2.png" alt="" width="578" height="438" /></a></p>
<p>OK. If you want you can run the app and see if the Camera interface pops up when you tap the button (That won&#8217;t work in the Simulator, give it a try on the device)</p>
<p>Now when the user takes a photo and decides to use it, the &#8220;imagePickerController:didFinishPickingImage:editingInfo:&#8221; method on your view controller (or other delegate) will be called. So you will get a UIImage instance, do your magic on it (if any) and then proceed to saving. In our demo there&#8217;ll be no magic applied to the image, so we will just save in a custom photo album the photo taken. (If you want to learn more about Image filters and such with the new for iOS5 CoreImage, have a look at the &#8220;iOS5 by Tutorials&#8221; book)</p>
<p>Let&#8217;s implement the callback:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>imagePickerController<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIImagePickerController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>picker didFinishPickingImage<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>image editingInfo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>editingInfo
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>self.library saveImage<span style="color: #002200;">:</span>image toAlbum<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Touch Code Magazine&quot;</span> withCompletionBlock<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>error<span style="color: #002200;">!=</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #4000c0;">NSLog</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Big error: %@&quot;</span>, <span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>picker dismissModalViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>So this is the category method, which takes in a UIImage, the name of the album and a completion block. The album may or may not exist already. If it does not, it will be created on the fly (yay). And the completion block will receive an NSError instance if there was an error in any step of the process.</p>
<p>That&#8217;s all about saving to a custom photo album with the ALAssetsLibrary+CustomPhotoAlbum category. If you&#8217;re interested have a look at the category code to see what&#8217;s going on behind the scenes.</p>
<p>Now to wrap up with the demo project code, let&#8217;s just add this one method for when the user cancels the camera UI:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>imagePickerControllerDidCancel<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIImagePickerController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>picker
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>picker dismissModalViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Let&#8217;s run the project; initially I have 2 albums in my photo library:<br />
<a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_3.png"><img class="alignnone size-full wp-image-977" title="Album_3" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_3.png" alt="" width="338" height="270" /></a></p>
<p>Then I take a photo by tapping &#8220;Take photo&#8221; in the app:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_4.png"><img class="alignnone size-full wp-image-978" title="Album_4" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_4.png" alt="" width="334" height="333" /></a></p>
<p>And after the camera UI is gone, let&#8217;s switch again to the Photos app on the device:</p>
<p><a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_5.png"><img class="alignnone size-full wp-image-979" title="Album_5" src="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/Album_5.png" alt="" width="338" height="271" /></a></p>
<p>Now, you can also play further with the new AssetsLibrary APIs &#8211; you can now edit files inside your own albums (yes, you read correct, not open and save copies, but edit files &#8211; though only the ones your app did create), but the category at hand should cover the basic needs of any photo app.</p>
<p>Here&#8217;s the complete Xcode project of the demo app: <a href="http://www.touch-code-magazine.com/wp-content/uploads/2011/11/CustomAlbumDemo.zip">CustomAlbumDemo</a> (it includes the category source code files)</p>
<p>I hope that&#8217;ll be helpful to you and also do let me know what other iOS5 features are you interested to read about.</p>
<p>Marin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

