In-app purchase bug with ‘1000 icons’ in Keep Calm

If you’ve tried to buy the 1000 icons upgrade in the latest version of Keep Calm on your iPhone you will find that you won’t be able to. If you’ve got an iPad you can buy it on there and then restore the purchase on your phone in order to active it.

TL;DR: I’m incapable of remembering to link up IBActions from both storyboards.


Resolved bugs in Keep Calm

Last week I published Keep 2.2 however there were a couple of odd bugs with in-app purchases that have now been resolved. I had the bug fixed on Sunday, however I was unfortunately unable to get an expedited review because of the extended Apple Developer site outage so the update wasn’t approved until today.

In-app purchase bug in Keep Calm 2.2

The latest version of Keep Calm has introduced a bug when attempting to restore previously purchased items in the store. Currently the code that restores the purchase my side is not being run (due to a really stupid faulty if statement) however if you have already purchased an item you can press the ‘Buy’ button again and it will automatically acknowledge that you have already purchased an item with no need to buy it again.

I’ve just finished a fix for this bug which I intend to send to Apple shortly, so hopefully the bug will be resolved within the next few days.

Keep Calm 2.2 available on the App Store


Today I updated Keep Calm to version 2.2. This new version adds the following new features:

  • Completely new flat UI – this is an iOS 7 style UI as I haven’t decided yet whether I will require iOS 7 when it comes out
  • The new UI makes it a lot faster to make posters – on average fewer taps are require to make a poster and it is now a lot clearer how one carries out basic tasks
  • The app is faster – for those interested, I took out redundant Core Data and Core Graphics calls
  • When you first launch the app you are welcomed with a new welcome screen. I’m particularly pleased with these because it provides quite a nice way of demoing some of the Pro features. Again, for those interested I use a UIScrollView and a single UIImageView that gets translated by the scroll offset
  • Runs much better on the iPhone 5 – I had spent a lot of time focussing on designing the regular iPhone version (because posters seem less stretched) rather than the full iPhone 5 screen which meant that there were a few buttons that weren’t showing up in the right places. This version is a lot more solid
  • Less code – this isn’t really a feature that my users need to care about, but I swear to god it makes my life a lot easier. By reducing the total number of delegates in the app (almost every single view controller – and some views/models too – declared a protocol) and making each view controller focused on the purpose of the app rather than being generic meant that I could write a lot less code. I also removed a lot of UIActionSheets because a) I don’t think they look very pretty and b) I really don’t like declaring them and writing UIActionSheetDelegate methods 😦

On the whole, users should find this update far more enjoyable and easy to use than previously as they upgrade over the course of the weekend.

Keep Calm 2.1 available on the App Store

Today I have released version 2.1 of Keep Calm on the App Store. This new version has the following new features:

  • Pro users can now export images of any size they like (up to 4000px by 4000px) making it easier to create posters for print or the web; you could create a desktop wallpaper if you wished
  • Pro users can now now also import backgrounds by pasting them from the clipboard rather than having to save them to their device first
  • Pro and free users now get faster scrolling across the app (I’ve optimised all the UICollectionViews to use NSCache to reduce loading time)
  • Pro users no longer see multiple menus appearing at once
  • All users can delete all their posters at the press of a button to reduce space
  • Cancel buttons now work in a more standardised way between the iPad and iPhone version
  • The images used by the app (icons, backgrounds, etc) are now significantly smaller which has reduced the App Store size of the app by 40%

Head over to the App Store now to update to Keep Calm 2.1. I intend to appropriately update the Android versions however I’m in the process of migrating code over to Android Studio from Eclipse.

Lessons from iOS development #4: Let’s forget this part 2

A few weeks ago I blogged about tactics you can use to reduce memory usage in your iOS app however I came across a neat class that can make your life a lot easier.

NSCache is a very simple class that is little more than an NSMutableDictionary except that it will automatically clear objects when memory usage becomes high or they haven’t been used recently. For an app heavy on file/network IO this is perfect.

Keep Calm’s main view is a grid of images. Usually these are loaded from a thumbnail that is automatically generated in the background every time the user updates their poster. This works fine, however it can take up to 10ms to load a picture, so when scrolling (especially on iPad where up to four pictures are presented in one row) to a new row there is a slight jitter even though the images are loaded asynchronously.

So then I added an NSCache to store all the thumbnails and suddenly scrolling became completely smooth because the thumbnails were only loaded when they needed to be (if it all, one would expect that a tablet with 1GB of RAM could handle ~30 images happily). Another benefit of NSCache is that you can limit the total ‘cost’ of all the items (the cost of an item is a relative number you can dictate).

Obviously it can be used for things other than just images, but if you are working on any kind of app that presents images in a grid you can save yourself a lot of time by using NSCache.

Introducing Keep Calm Creator 2.0


I’ve today updated Keep Calm Creator on the App Store to version 2.0. The new version is highly optimized and most users should find that the app is around 2/3x faster. I’ve also added new features, including support for using emoji as the crown and the you can now see a grid of all your created posters on the iPhone.

mzl.xwihuzpeThe new emoji feature allows you to type in emoji to create a crown based on them.

You can update to Keep Calm Creator 2.0 on the App Store now.


Lessons from iOS dev #1: Threads solve nothing

A bit of prehistory: I first wrote Keep Calm on Android about a year ago and the whole app run on the UI thread. All posters were generated, saved, edited, etc on one thread (unless the system did it on another thread for me, which it generally didn’t). I then learnt the quirks of concurrency on Android and I thought great, now the app should run a little smoother. By last summer when I was writing the first version of Keep Calm on iOS I had fallen in love with concurrency, and even the version currently in the store uses about thirty odd threads (hence why it is so slow, and I’m pushing an update).

Firstly, concurrency is absolutely vital in making a good app. You can’t do network communications, heavy file IO or complex processing on the UI thread because it will begin to become unresposive.

Secondly, don’t use performSelectorInBackground: when you need to do something more than once in the background. It creates a whole new thread which is often completely unnecessary. The superior alternative is to use NSOperationQueue. My current pattern is to use a single background queue across the application because creating additional queues is unnecessary: one NSOperationQueue doesn’t represent a single thread (unless you limit it to) and can run several operations concurrently, so there is no real need to create new queues.

Thirdly, it is far too easy to over-use concurrency. I found myself doing loads of UI operations on another thread which eventually meant I was drawing things about three times and just wasting time and processing power.

I have a new rule for working with concurrency: the view and controller layers (I use MVC, as one should with iOS development) should operate on a single main thread however the controller can instantiate tasks on the Model layer either on the main thread or on my separate NSOperationQueue. My reasons for this are because it reduces complexity, is easy to understand and actually ensures that the app ends up being pretty quick. Obviously there are some tasks that the controller may ‘do’ in a separate thread, however I consider them to be Model tasks.

Keep Calm for Android updated

I’ve now updated Keep Calm so that it now has a new Holo UI and better quality saving of the created posters. Unfortunately the new version no longer supports Android 2.1 because I wanted to improve the general quality of the app and this meant dropping the older features.

Despite this, the update gives the app a new refreshing look that is much easier to use – the swipe menu at the bottom is now gone and has been replaced with an Action Bar:


You can get the new version over on Google Play now for free. If you want to read more information about the update, here is what I wrote about the Pro update earlier this week.

Keep Calm Pro for Android updated

This morning I released an update to Keep Calm Pro for Android and it changes quite a bit. Before I overview the new features, here are some common complaints about the previous version:

  • UI was difficult to use
  • Poster was ‘forgotten’ on device rotation
  • Poster wouldn’t always save/didn’t appear in the Gallery app for a long time
  • UI looked nasty and didn’t feel like an Android app
  • Posters saved were poor quality
  • No option to save square posters

Keep Calm Pro 1.9 has resolved all of these issues. The first major change is the appearance of the app; the image on the left shows what it used to look like and what it now looks like:

ImageThe new UI is now ‘Holo’ and has an Action Bar on all versions of Android (I’m using Action Bar Sherlock) which means it now conforms to the newer Android design schemes. This also lead to a huge reduction in the amount of code as well – and there is definitely a major performance boost because I’m using more standard techniques now.

The poster is no longer ‘forgotten’ when you rotate the device. It was a weird ‘feature’ of Android but I’ve now fixed it and it means that the UI will now properly turn.

Posters should now always save and appear in the Gallery app straight away. I’ve also optimized the saving routine as well because before it was running a Media Scanner across your entire SD card however now it will only scan across the specific file. The saved images are now high quality PNGs and appear exactly as they do in the app. A lot of Android users (the iOS version has had the feature for a couple of months) were complaining that their posters weren’t fitting on Instagram however there is now an option on the Share menu to create a square poster instead:

ImageAnother change that I’ve implemented is that the color of the icon will now change with the color of the text, which makes far more sense than staying white.

Overall Keep Calm Pro has significantly improved, and you can head over to Google Play to get the new version.