iOS Camera Roll Bug

I recently mentioned a bug in the Photos app in iOS 5. What was happening to me was this:

  1. Open Camera app.
  2. Take photos.
  3. Look at Camera Roll from Camera app and verify that photos are there.
  4. Quit Camera app.
  5. Open Photos app.
  6. Navigate to Camera Roll.
  7. Photos app crashes.
  8. Open it again, and navigate to Camera Roll again.
  9. Camera Roll appears empty.
  10. Look again from Camera app, and the Camera Roll shows the recent photos.

Clearly, the photos are in my Camera Roll, but they're just not appearing when viewed from the Photos app. So WTF?

After a good deal of research I was able to track the problem down to what would seem to be a corrupt database. The solution is kind of a pain, but it works and seem to keep the problem from happening ever again. So here it is, the fix:

  1. Plug in and back up your iPhone, for good measure.
  2. Download and install either iExplorer (formerly iPhone Explorer) or any app that lets you view the file system of your iPhone.
  3. With iPhone still connected, launch iExplorer.
  4. In iExplorer navigate to the Your_iPhone->Media->PhotoData folder.
  5. If you're at all concerned or paranoid (like I am) back this entire folder up to your computer by simply dragging it from iExplorer to your Desktop.
  6. Delete the following three files:
    • PhotosAux.sqlite
    • Photos.sqlite
  7. Reboot your iPhone.

When the iPhone returns to service the Photos app should show your Camera Roll repopulated with your recent photos. If you don't have any other albums, you're done. Otherwise, any other albums you had — particularly ones that you'd been syncing from iPhoto — will need to be resynced. Simply open up iTunes and perform a sync operation.

That's it! You're done. From here on out your iPhone should behave properly when taking new photos; the Camera Roll should always display recent photos from inside the Photos app.