I got a really hard to debug issue today.

When finishing up the changes in the post settings I realized that if you saved the post from the settings tab it crashed. Badly.

-[CALayer release]: message sent to deallocated instance 0x4d3ca40

What made it hard to debug was that the obvious cause was something in the post settings code, since a) that was what I was changing, and b) visiting the post settings view was making the bug appear.

After long hours trying to find the cause, it turns out visiting the post settings was triggering low memory warnings, so when the post editor was dismissed, the blog view had been unloaded.

The solution, storing the selected view controller for BlogViewController on viewDidUnload, and restoring it on viewDidLoad. Good thing is that this also fixed the issue when saving a post would take you to the comments list some times.

So keep that in mind: view controllers can (and will) unload their views when they are hit by a low memory warning, and viewDidLoad should work in that case too.