When should I use UIImagePickerControllerSourceTypePhotoLibrary instead of UIImagePickerControllerSourceTypeSavedPhotosAlbum?

Micah Hainline picture Micah Hainline · Nov 10, 2011 · Viewed 8.8k times · Source

I have an application that allows the user to pick a photo from their device. To do this, I'm using the UIImagePickerController, but the problem is that I'm unsure whether I should be using a source type of UIImagePickerControllerSourceTypePhotoLibrary or UIImagePickerControllerSourceTypeSavedPhotosAlbum.

On my iPhone 4 running iOS 5 the saved photos album gives a much better experience, but when I try to use my iPod Touch running iOS 4.3 using a photo that I synced from iTunes, it doesn't even show up. If I switch to PhotoLibrary my iPod works but my iPhone experience is worse. When I ask the UIImagePickerController it says the SavedPhotosAlbum is available on my iPod, but I don't seem to have a way to determine that it's empty.

What is the best way to determine which source type to use? If I have a way to determine if the Saved Photo Album is empty, I guess that would work, but I don't see one.

Answer

larsacus picture larsacus · Nov 11, 2011

UIImagePickerControllerSourceTypePhotoLibrary references the entire photo library, letting the user choose which album. UIImagePickerControllerSourceTypeSavedPhotosAlbum goes straight to the camera roll album without giving the user a choice as to which album to choose from. They're similar, but different. You can get to the camera roll from PhotoLibrary; you can access only the camera roll from UIImagePickerControllerSourceTypeSavedPhotosAlbum.

Reference.