Inspecting iOS State Restoration Data

State preservation and restoration allows iOS apps to save state when they’re sent into the background, and restore that state if the app is killed and then relaunched. If you’ve ever implemented state restoration yourself, you may have run into a case where it’d be helpful to see exactly what state iOS was storing.

It turns out that Apple actually provides a tool to help you do just this, but it’s kind of hidden away and documentation is relatively sparse. Fortunately, it’s pretty easy to use. When you run it, it’ll output a structured plist showing all of your encoded objects, their restoration identifiers, and restoration class information. Here’s a step by step guide.

Continue reading “Inspecting iOS State Restoration Data”

Fixing Xcode’s Invisible Cursor

When writing code, I generally like to use a dark theme in my IDE or text editor. For Xcode, I really like the Tomorrow Night and Seti themes in particular (both of which can be easily installed using the Alcatraz package manager).

In Xcode, however, there’s a slight problem for dark theme fans:

xcode_beam.png

By default the ‘i-beam’ mouse cursor in the editor is really hard to see, particularly on a high resolution monitor. I’d often find myself losing it and having to shake the mouse to activate El Capitan’s mouse zoom feature.

But there’s a solution! I noticed that Terminal.app’s i-beam cursor has a stronger shadow, which makes it easier to see on dark backgrounds. The cursors are just .tiff image files, so it’s trivial to steal Terminal’s cursor and stick it into Xcode.

If you want to do it manually, you’ll need to copy /Applications/Utilities/Terminal.app/Contents/Resources/ShadowedIBeam.tiff over the top of /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff. Or you can just run this snippet in Terminal, which will do it for you:

cd /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources; sudo mv DVTIbeamCursor.tiff DVTIbeamCursor.old; sudo cp /Applications/Utilities/Terminal.app/Contents/Resources/ShadowedIBeam.tiff DVTIbeamCursor.tiff

The change in shadow is actually only slight, but I find it makes a big difference in helping me locate the cursor:

terminal_beam.png

And here’s a before and after:

before_and_after_beams.png

Update: On Twitter, @TwoLivesLeft pointed out that iTerm’s cursor has even better contrast:

Update 2:Also on Twitter, GregHeo, there’s a super-mega visible cursor available on Github: https://github.com/egold/better-xcode-ibeam-cursor