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.


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 v1.1 iOS 6 iPad bug

In the reviews of Keep Calm for the last week or so people have been complaining that they can see the text ‘Tap add to create a new poster’ but they cannot see the Add button. I tried different strategies to get the app to ‘not display the add button’ but I could not work out what the problem was. As far as I was concerned it worked fine in the simulator and a real device running iOS 5.1 and 6.0. But then I noticed a problem.

Basically the ‘bug’ only seems to occur when the user launches the latest version (1.1 – v1.2, which is in production, clears up the bug) of the app on an iPad running iOS 6 in landscape mode. Ironically it can be resolved by launching the app in portrait mode or rotating the iPad to an alternative orientation after the app has launched.

Another ‘bug/user error’ that is occurring is not being able to save posters on iOS 6. You must go into Settings > Privacy > Photos and ensure that Keep Calm is allowed to access your photos otherwise it cannot save your posters.

Developer bit on why the orientation bug has appeared

The fundamental element of the app is a UIViewController. When the app loads all my code in viewDidLoad gets run as if the app is in portrait mode regardless of device and actual orientation. Previously I had a lot of generic code that set up the UI based on screen dimensions; I needed universal code that would run on iPhone/iPad/(iPad Mini?) and in iOS 5 so I couldn’t – and didn’t really want to – use auto layout.

On iOS 5 willAnimateRotationToInterfaceOrientation:duration: then gets called if the app is running in landscape mode so that orientation configuration code can be run. The code in here all works quite nicely and configures the UI but the problem occurred because iOS 6 no longer calls this function on launch (but does still call it when the device is rotated, hence why rotating the device resolves the issue).

It turns out that iOS 6 will now call viewWillLayoutSubviews after viewDidLoad. This also gets called for other reasons as well so I resolved the issue by adding a boolean property and only calling willAnimateRotationToInterfaceOrientation:duration: on the first call of viewWillLayoutSubviews. This resolved the issue on iOS 6 and maintained backwards compatibility with iOS 5.