an iOS implementation of http://nullprogram.com/blog/2012/02/03/