Making Friends with Documents

February 25, 2014

I’ve been rather awful at keeping this blog up to date. As a vague attempt at new content, here’s a link to my talk at NSScotlandMaking Friends with Documents.

I explain how to harness the power of NSDocument/UIDocument to make your life as a developer easier and make sure that your document based applications include all the document features that users expect. I also take an in-depth look into undo support, autosave, versioning, supporting iCloud and how to utilise the lower level write APIs to create flexible, cross platform document formats

You can find the talk at


A little trick for producing a super quick iPad port

October 15, 2011

Speaking of Sleeps to Christmas 2, here’s a quick tip for quickly putting together an iPad version of an app. I don’t think this is an original idea but I’m not sure where I saw it.

The key thing to realise is that if you already have retina display artwork for the iPhone 4 in portrait mode then that’s usually 640×920 pixels. An iPad’s display in portrait is 768×1004. Only a 128×84 pixel difference.

See where I’m going with this?

Yes, you ask your friendly illustrator to make you a frame for around the artwork!

Like so…

Before frame added


After frame added

And then all you need to do is add a toolbar where each button shows the view controllers from your iPhone version in a popover, telling it to hide the navigation bar on the view controller if we’re on an iPad and you’re done.

View controller for the iPhone, full screen

Same view controller but shown on the iPad

Creating a (admittedly simple) iPad version of Sleeps to Christmas 2 took about a couple of hours of artwork and less than one hour of coding. I’ll likely work on a better port in the future but for now this was good enough that I was happy to ship it as a 1.0.


Going Indie: A two month update

October 15, 2011

It’s been a little over two months now since I left my day job and “went indie”. I’d like to give a short update on what’s happened since then and what’s going to happen in the future. Partly in case anyone cares and partly because I like publically stating plans and then failing to stick to them as cooler stuff comes up!

In my last post I stated that my plan was to work for six months or so on my Big List O’ Projects. Well, something pretty cool came up that I couldn’t resist so that’s been put on hold. For the past couple of months I’ve been working with Jeff LaMarche, Rob Rhyne and the rest of the superhuman developers at MartianCraft developing some kick ass projects for clients. When the opportunity came up to work with those guys, to LEARN from these guys, how could I not take it? So for the forseeable future this’ll be what I’m doing, honing my skills while working with some of the best guys in the industry for some of the best clients in the industry. I really couldn’t ask for a better group of people to work with.

BUT that hasn’t stopped me working on some of the lower hanging fruit from my Big List O’ Projects. Today I released a sequel to my old favourite Sleeps to Christmas. Sleeps To Christmas 2 contains animated characters, much higher quality music and is generally just a lot more polished and, I think, fun than the original! I’m really pleased with it and judging by the fact that it’s just hit the Top 50 Free Apps in the UK and has a 5 star average review so far I think customers are too! Once again, it’s really lagging in the US though. I just don’t think I’m ever going to crack that market for Christmas. The UK is so much more FOCUSED on Christmas as a holiday whereas the US seems to think about Halloween, then Thanksgiving and THEN Christmas. Anyway you can download it here and I hope you like it.

So now that I’ve scratched that itch I can move onto working late nights on my next app. It won’t be the BIG ONE that I want to work on some day but it should be good.

The first couple of months as indie have been superb, here’s to the next few years!


“I, Partridge” Spotify Playlist

September 29, 2011

I’m a massive Alan Partridge fan and was delighted today to receive a copy of his “auto-biography” “I, Partridge: We need To Talk About Alan” (if you’re a Partridge fan then it’s a must buy). I’ve only just started reading it but Alan mentions that he’s prepared an accompanying soundtrack but Harper Collins were unwilling to produce and distribute the CD. No fear, I’ve put together a Spotify playlist with the tracks lists. Well, all of them except one, Mamunia by Wings which I can’t find the original or a cover of. Also, Pipes of Peace by Paul McCartney (noticing a link here?) Isn’t available but I did substitute a cover version of that.

Anyway without further ado, here’s the link: I, Partridge Spotify Playlist

A little off-topic perhaps, normal service will resume at some point.


Going Indie!

July 4, 2011

Well, this is a long overdue post!

Last week I decided to finally quit my day job to become a full time independent iOS/Mac developer. I’ve just turned 28 and while I enjoy my day job as a Senior Engineer at Ciqual I feel that it’s not the right direction for me at this point in my life.

I want to build my own products; I want to make exciting things and see customers get excited by them too! There’s never been a better time to develop apps for iOS and Mac and I want to be a part of it.

I have to admit, I also don’t want to be known simply as the Sleeps to Christmas guy! I’ve got other apps out but between a busy job in a startup and maintaining some semblance of a social life I’ve not really been able to give them the love and attention they deserve. For the same reason, I’ve also been reluctant to kick off new projects and I’ve been turning down some excellent opportunities at contract work.

So I’ve resigned from Ciqual (who, incidentally are hiring in Edinburgh and are a great company to work for) and will be serving my notice period until the 5th of August, taking a one week break in the sun on Cape Verde in Africa, then returning refreshed and ready to start work on my next iOS project.

My intention is to spend at least the first six months full time working my way through some of the list of app ideas I’ve had sitting in Things for the last few years. I’m incredibly excited about finally being able to start work on these and get shipping again.

After that I’ll assess the situation and see if I can still pay the bills or if I need to pick up some contract work. Six months after that we’ll see if I need to return to a full time job with my tail between my legs. Hopefully it won’t come to that though!

I’d like to thank everyone, especially those on Twitter, MacMacDev and at WWDC, who have supported me and encouraged me to follow this dream. All you indie developers out there kicking ass and shipping apps are an inspiration.

PS I’ll definitely be visiting Appsterdam at some point this year too. It’d be great to see people out there!


Adding a “Collect Them All” feature to your application

May 7, 2011

One of the pieces of polish that was called out recently in TweetBot was the way in which it displays which other TapBots apps that you have installed.


This is actually something I’ve been doing for a while in the WeeWorld apps I’ve worked on and since I’ve seen a few questions asking how it’s done I’ll give a quick run through.

There’s no hackery or use of private APIs as I’ve seen some people suggest;  the trick is simply to publish a URL scheme for each application even if it isn’t used for anything else. You set this up in your application’s Plist file by editing the URL Types (CFBundleURLTypes if editing in text.)

Plist setting

You can then check for availability of the application simply by checking if anything installed on the device will respond to that URL scheme.

BOOL isCountdownInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weemeecountdown://"]];

I then use this value to decide whether to draw a tick over the application. If they click on the icon of an app they’ve purchased then I simply thank them for buying it and ask if they’d like to leave a review. If they click on an icon for an app they haven’t purchased them I take them to the app store page.

WeeMee Countdown Collect Them All Implementation

So why would you want to do this?

  • Strengthen your brand by enforcing a shared identity for a suite of apps. (Marketing guff, sorry).
  • Affiliate links! As anyone who saw me speak at the recent NSConference can attest, affiliate schemes such as LinkShare or TradeDoubler can be a great source of income for any developer. Even if the user clicks on the links to see your other apps but doesn’t buy them you’ll still receive 4-5% of ANY purchase they make from the iTunes store.

iOS Update and Device Statistics

December 15, 2010

I’ve just launched a new application, WeeMee Countdown, which I’ll be cross promoting from Sleeps to Christmas. While poking around in the analytics for Sleeps I found some interesting information that may be useful to others.

Sleeps has a large userbase, 1.5milllion downloads, and is getting between 100,000 to 200,000 launches a day at the moment across a pretty varied array of users. This gives me some great statistics on device popularity and iOS update versions.

Here’s the visualisation of stats over the last month, click to enlarge;

Now the iPod touch stats may be a little bit lower as a I suspect that some users may never set up WiFi on their touch but the rest is quite interesting.

Key points

  • 28.8% of users still on iOS 3.1!
  • iPhone most popular device
  • I released version 2.0 in Sep 22 ’10 but there are still a few people on older versions. Most of my downloads have been since September so the stats are a bit skewed but it does show that there are people don’t really update their apps

Don’t Give Up

November 16, 2010

This is the sales graph of Sleeps to Christmas over the last 3 years. The message?

Don’t give up.

If you think you’ve got a good product, keep pushing it. Keep updating. Keep marketing. Keep it alive. You never know when it’ll catch a wave and ride up the charts.

Sleeps has an advantage in being seasonal but, given that it went from zero to #1 in September this year, there must be a catalyst for that. A review on a popular site, a celebrity mention* anything could resurrect your app from being hidden away on the store to hitting the coveted Top 100 charts.

* Sleeps hitting the charts this year was partly down to finding out Tom from McFly was a fan and giving the app a shout out on Twitter. Yes, I feel dirty


Using AdWhirl To Achieve High Fill Rates

July 20, 2010

I’ve been running ads in Sleeps to Christmas since it launched in August 2008. During that time I’ve moved between a few suppliers of ads. Each time I did this it involved code changes but I’ve now settled on a solution called AdWhirl which allows you to manage this better. In this post I’ll be writing about why I’m using AdWhirl and how to integrate it in your application.

First, let’s define some of the terms I’ll be using:

  • Fill Rate is (number of ads received / number of ad requests sent ) * 100. So if you request 100 ads but only receive 90 then you have a 90% fill rate.
  • eCPM is “Effective Cost Per Mille (1000) Impressions” That’s (total earnings / impressions) * 1000 and is useful for comparing ad provider against ad provider. Earnings can either be an a CPM (cost per 1000 impressions) or CPC (cost per click) or a combination of both (as in iAds).

All else being equal you want to go with whichever network is providing the highest eCPM rate.

I mentioned earlier that I’ve moved between ad networks a few times. This was due to issues with low fill rates and low eCPM and also the quality of adverts from some suppliers (no BIKINI BABES plz k thx). (I previously put together a post explaining the numbers in excruciating details but I was alerted to the fact that most providers don’t let you provide details of earnings so that’s been mothballed for now).

Earlier this year I moved to Google AdSense for 100% of my requests as it provided a near 100% fill rate and high eCPM so I thought I’d solved this problem but iAds entering the fray has complicated things. iAds was (and really still is, until it rolls out worldwide and more than two adverts become available) a bit of an unknown in terms of options so I wanted the option to be able to dynamically reallocate the proportion of my requests going to iAds at will. If it was earning well, I’d send all my requests their way, if not then I’d send them to AdSense, if I requested an advert from iAd and it wasn’t available then I’d have something to fall back on. I started to roll my own solution for this but I was then alerted to AdWhirl.

AdWhirl is an open source Mediation layer for adverts. It’s owned by AdMob (thus Google) but both the server and client components are open source under the Apache 2.0 License so I’m fairly confident that they’re safe. I’ve encountered one other mediation layer in the past, Mobclix, but they function by collecting and distributing the ad requests on the server side and feeding them to you. This means that they collect all the money from the networks on your behalf, take their cut and then pay you (3+ months later usually).

AdWhirl makes the requests from your application, their server component is really just there for configuration purposes and they don’t take any cut of the revenue nor do they store any of your account details with the ad networks. Its sole purpose is to provide a mechanism for dynamically deciding in which order requests for adverts should be made. You do this by setting up a priority list in their web interface and allocated a percentage of requests. You can then set up a ‘backfill’ list which is used if the other suppliers are not available. This ensures that you should also have 100% fill rate. I cannot emphasise how important this is. Every time you fail to display an ad you’re leaving money on the table.

For the moment, I’ve configured AdWhirl to set iAds to 100% of requests and then fall back to AdSense if no iAds are available. iAds provide the highest eCPM in the industry at the moment, despite only having two adverts, so it makes sense to give them the most requests. They are having serious inventory problems at the moment though, providing only around a 10% fill rate and with only two adverts on the go click through rates are dropping as most people have seen the adverts already.

Integrating AdWhirl was a cinch, it took less than an afternoon, and allowed me to clean up a lot of my code. You simply add their framework, select which ad networks you wish to use by adding them to your build target, add the delegate methods for your supplier (all well documented in the headers) and then it’s just a couple of lines to request an advert and add it to your view

AdWhirlView *awView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.view addSubview:awView];

(Setting up the frame if you want to place it elsewhere on your screen, natch).

AdWhirl manages showing and hiding adverts so you don’t need to worry about Apple’s restrictions on not showing empty frames for iAds and so on.

AdWhirl currently supports AdMob, AdSense, iAds, JumpTap, MdotM, Millenial, Quattro and VideoEgg. You’re under no obligation to integrate them all but I’d recommend doing at least two or three. Advertisers like Millenial often do short term promotional campaigns for big companies that can be very lucrative if you’re willing to switch over all your requests for a short period of time.

You can find more information on AdWhirl at The integration instructions in their SDK are great.


Saving NSUserDefaults under iOS 4

July 17, 2010

iOS4 introduced ‘multitasking’ wherein rather than being terminated your application is put into a suspended state where it’ll wait either until the user opens it again, the OS terminates it as it needs the resources or the user taps the ‘stop’ button in the task tray. (Oliver Drobnik has an excellent in-depth explanation of this.)

I encountered a problem today where my application didn’t seem to be saving the parameters I set in NSUserDefaults when the application finishes (I save some state based on the time the user exits. Usually I’d recommend updating the NSUserDefaults object as soon as the user finalises the action rather than at the end of the current application run).

I know some other people have been having this problem too so I thought I’d share the solution, as it’s exceedingly simple.

You need to call the synchronize method on your NSUserDefaults object.
[[NSUserDefaults standardUserDefaults] synchronize];

The OS periodically synchronizes the NSUserDefaults object while your application is running, apparently around every 15 seconds. It seems that when your application backgrounds sometimes it won’t be synchronized in time, if the user kills it from the tray or the OS reclaims the memory immediately. Manually calling synchronize will enforce a save and ensure your data is there next time.