iPhone camera roll bug makes photos unavailable, hack your way to a fix

TL;DR … scroll down for a solution.

What happened?

My iPhone 4 with iOS5 started failing in a peculiar way a couple of weeks ago. I could take still photos and video without any trouble, but the camera roll display (in the Photos app) would fail to show thumbnails correctly, and attempts to pull the images onto my iMac wouldn’t work. Both iPhoto ’11 and the Image Capture app on Mac OS 10.7 could see my iPhone, but said that there were 0 photos on the device.

Really, I just wanted to get my photos & video off the device. And I couldn’t. I tried lame workarounds like emailing photos to myself (worked for photos, but not large videos) and syncing to Dropbox (failed, Drobox app couldn’t read photo library … which is itself a clue).

I needed a real fix. While I don’t know what caused this problem in the first place, I have one idea. Read to the end to find out.

Symptoms

Here’s what the thumbnail view looks like:

As you can see, several blank images, and several thumbnails are duplicates. Funny thing is, you could select items and see the correct image.

In the Settings app, under General | About, the number of reported photos is off the charts. Geeks will recognize this as a rather special number.

Finally, iTunes shows some space used by “Other”. This is close to the amount of space used by my photos & videos.

Solution

After Googling a bit with no clear solution in sight, I turned to Twitter. @jkubbeaver had the same problem, and stumbled upon a solution that worked for him, documented here. In case that link vaporizes, here’s a summary:

  • Download and install iExplorer, which allows you to manage the filesystem of your iPhone.
  • Fire up iExplorer with your iPhone connected via USB cable, and, as a precaution, copy photos/videos from the iPhone’s DCIM folder to your computer. At this point, you now have the files you want, but you still need to fix the underlying problem.
  • Navigate to the iPhone’s PhotoData folder, copy the com.apple.photos.caches_metadata.plist, Photos.sqlite, and PhotosAux.sqlite files to your computer (again, as a precaution), then delete them from the iPhone’s PhotoData folder. This deletes the iPhoto camera roll database and thumbnails, but does not delete the photos themselves.
  • Reboot your iPhone, navigate to the Photos app, and let it rebuild the camera roll database automatically.

At this point, all should be back to normal. This solution worked for me.

Addendum: why did this happen in the first place?

I’m not sure yet. When I upgraded to iOS5, I did not initially enable Apple’s PhotoStream service. After a few days, I enabled PhotoStream to give it a try … and then started seeing the symptoms. Is PhotoStream to blame? Unsure, but it’s the only thing that I can remember changing between “no problem” and “problem”. YMMV.