39

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.

Micah Hainline
  • 14,367
  • 9
  • 52
  • 85

1 Answers1

63

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.

john.k.doe
  • 7,533
  • 2
  • 37
  • 64
larsacus
  • 7,346
  • 3
  • 26
  • 23
  • I guess what that means to me is that I'll use UIImagePickerControllerSourceTypeSavedPhotosAlbum when the device has a camera, and UIImagePickerControllerSourceTypePhotoLibrary otherwise. – Micah Hainline Nov 14 '11 at 14:58
  • 1
    I'm also not sure if user's screenshots or saved images from the web will also save in the user's camera roll. – larsacus Nov 14 '11 at 17:26
  • True, but for what I'm using it for, this is the right choice. – Micah Hainline Nov 14 '11 at 20:46