Unit testing for blocks based APIs

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 – when you create new Xcode project just check the checkbox in the save dialogue and voila everything is setup automatically for you:

This will add unit testing to your project and when you click Product->Test from Xcode’s menu your unit test will be run. Cool and smooth.

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:

- (void)testExample
{
    STFail(@"Unit tests are not implemented yet in utb_testTests");
}

It’s designed so that it’ll fail by default. Eventually if you run the tests (Cmd+U) you’ll see the tests fail (though my experience shows even this simple example test will succeed for no reason many times):

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.


How to deal with copycats?

When you create an application in iTunes connect it automatically checks whether an app with the same name exists and doesn’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 “HD” or “Lite” 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 – just grabbing a bit of dough under the radar)

Let’s have a look at few apps:


Software that completes me as an iOS developer/publisher

When I started doing iOS development was pretty much everyone for himself and that was scary. Now on the other hand there’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’s a round-up of what  I really can’t do without:

Coding and development

Well, yes – 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!
You can get Xcode for free if you are registered Apple Developer – more info here:
http://developer.apple.com/xcode/
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 “Alt + Space bar” gives you super fast iOS SDK documentation search and more – it remembers what you have looked up last, and unlike Xcode 4 it gives you the TOC and more.

This app was priceless while I was writing for “iOS5 by Tutorials” because I had to constantly dig through the new API references. Much recommended, you can get it from the app store – it’s FREE:

http://itunes.apple.com/app/dash/id458034879?mt=12

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 – I didn’t need any more convincing.

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 … I also have Espresso (built after Coda), but I feel Coda is much better. Get Coda at Panic’s web site for 99$: http://www.panic.com/coda/


Success Story on the App Store and beyond

If you think success has a universal definition – get this – you are wrong. Everyone wants something different, therefore “success” – it’s a personal thing.

In this post I’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’t be more happier.

1 year ago

September 2010 I left my job in Berlin, Germany – I was disappointed by it to a degree that without any plans for the future I just didn’t want to look for another job, but do something else instead of being an employee. Further – 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 “Pimpy” to the App Store just to find out sales were low, people enjoyed the app, but many of them didn’t get what it can do; and also some people cracked it quite fast and spread it around torrent web sites.

So … what happened after that and changed things so much?


The ARC compatibility has already been merged in the latest branch of cocos2d – the 2.0 beta. And that’s great of course However “ARC compatible” 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 [...]

Add an iCloud photo gallery to your app with MTICloudPhotoGallery library

As I previously mentioned on TCM I wrote a nice little library to add photo publishing to iCloud last month when I was finishing “Fun Photo Booth”. Thanks to the chapter “Beginning iCloud” in “iOS 5 by Tutorials” by my co-author Cesare it was quite easy to enable iCloud support, but of course there were [...]

iPhone SDK and Objective-C for absolute beginners

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

Fire, smoke and waterfalls with Particle Systems in iOS5

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…