Aleksandar • Vacić

iOS bits and pieces

Using State Preservation with Core Data

In previous post on state preservation and restoration, I presented the basics. This post deals with something that’s fairly common in data-driven apps.

Core Data is one of my favourite iOS frameworks; I use it in almost all of my apps, anything that requires even a minor object graph. So, let’s see how to save/restore state of table views (it’s the same for collection views) fueled by NSFetchedResultsController.

Fix AirPlay on Huawei E586 mifi

I’ve been using Hauwei E586 as my mobile 3G modem for quite a while. It works really good for up to 4 devices. One thing that did not work properly was AirPlay. Devices would see each other at first, make a connection and immediatelly drop it. I did not have a solution for this until recently where I stumbled on cause of the problem. By default, this little setting is set to ON:

One little setting to fixed

Switch it to OFF and - no restart needed - AirPlay works great. Apparently Huawei added this at some point late in the firmware update cycle so not a lot of people encountered this. Nor many of them need AirPlay on the go. :)

Try Couch to 5k - iOS and device charts

Less than a month ago, I said that next major update of my running apps will support iOS 6 and up. Well, scratch that - it will be iOS 7 only, for few reasons:

  • I got inspired and did a much, much larger work than originally intended, which added a full month of work to original timeline.
  • iOS 7 is just around the corner. By the time I get this tested, packaged and ready, iOS 7 GM build will be available for dev and Apple will call for app submissions.

My original idea was to submit an iOS 6 version, work out eventual kinks and bugs and then submit iOS7 only update. As it is, it will be trial by fire with new features, new UI and all on the brand new iOS, but I think it’s worth it - this 3.0 update will be a killer one.

With that said, I needed to do some more preparation. I looked at the charts and stats provided to me by FlightPath - a TestFlight live app usage service (I recently got into the private beta - this is an awesome thing they are building there).

Here are some very interesting things, from the last month of usage (Jul 19 to Aug 19, 2013).

State restoration in iOS 6 without storyboards

Back in iOS 6, Apple added a set of APIs with specific aim to greatly increase user experience during app switching. That API is Application State Preservation and Restoration - you can learn about it using the official docs or WWDC 2012 Session 208 or using a series of great posts by Keith Harrison.

What’s common about these and few other resources on the web is that they lean on Storyboards and if you happen to not use them - like me in this particular case - then it’s not entirely clear where you do start. This API was confusing to me at first, but once I implemented it, it was really obvious how good this API is for people, in everyday usage. It’s worth the time.

Also, an important note: with iOS 7 and its outlined principles and human interface guidelines provided by Apple, this API became a whole lot more important. The transitions between the apps are much more natural and re-assuring if you have properly implemented this API.

In this post I’ll show you how I’ve implemented it in my running apps. They do not use storyboards and their basic structure is tab-bar controller with each tab containing a navigation controller with rich navigation stack inside.