UIImagePickerController in 3.0

So, you know what happens if you don’t do an exhaustive test of all the apps you support before a system upgrade? Well, let us tell you what happens if you don’t do an exhaustive test of all the apps you support before a system upgrade. You get emails like this:

Bought this program yesterday. But it crash when I select the camera view. I use OS3 on iPhone. Will there be an update that fixes this problem. ???

Oh, dear. Not only is it embarrassing to ever get any emails like that, in this case it’s particularly poor form as it was very foreseeable indeed that mucking around with the internals of UIImagePickerController as described here would be likely to break with a system revision. Whoops.

On the bright side, it turns out that the bits that throw an exception aren’t actually needed anymore, as the UI has been upgraded quite nicely between system versions; we’d been digging in to hide some annoying background and text which is no longer there, all the UI is fitted into an unobtrusive bottom bar. So, to update the above link, what the view hierarchy looks like in 3.0 is

and if you’d like to — as we do — insert an overlay between the preview and the controls, for 3.0 it’s simply

Considerably simpler. And it’s probably an OK bet that as the hierarchy has stayed with the preview image view as the first (bottom) child of a PLCameraView for two major revisions now, this same insert code should continue to work for the future now that we’re not doing any direct messing with any of the other views. Of course, anything that isn’t specifically documented is never guaranteed … so the real lesson here is, make SURE that you keep a list of anything even VAGUELY questionable you do and make sure you test it thoroughly between System revisions so that you don’t get blindsided by rightfully annoyed customers the day after release!

Alex | June 18, 2009

Leave a Reply