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.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s