我什么时候应该使用UIImagePickerControllerSourceTypePhotoLibrary而不是UIImagePickerControllerSourceTypeSavedPhotosAlbum?

时间:2021-12-13 16:05:19

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.

我有一个应用程序,允许用户从他们的设备中选择一张照片。为此,我正在使用UIImagePickerController,但问题是我不确定是否应该使用源类型的UIImagePickerControllerSourceTypePhotoLibrary或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.

在我运行iOS 5的iPhone 4上,保存的照片相册提供了更好的体验,但是当我尝试使用我从iTunes同步的照片运行iOS 4.3的iPod Touch时,它甚至都没有显示出来。如果我切换到PhotoLibrary,我的iPod可以工作,但我的iPhone体验更糟糕。当我问UIImagePickerController它说我的iPod上有SavedPhotosAlbum,但我似乎没有办法确定它是空的。

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.

确定使用哪种源类型的最佳方法是什么?如果我有办法确定保存的相册是否为空,我想这可行,但我没有看到。

1 个解决方案

#1


60  

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.

UIImagePickerControllerSourceTypePhotoLibrary引用整个照片库,让用户选择哪个相册。 UIImagePickerControllerSourceTypeSavedPhotosAlbum直接进入相机胶卷相册,而不让用户选择哪个相册可供选择。他们是相似的,但不同。你可以从PhotoLibrary进入相机胶卷;您只能从UIImagePickerControllerSourceTypeSavedPhotosAlbum访问相机胶卷。

Reference.

参考。

#1


60  

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.

UIImagePickerControllerSourceTypePhotoLibrary引用整个照片库,让用户选择哪个相册。 UIImagePickerControllerSourceTypeSavedPhotosAlbum直接进入相机胶卷相册,而不让用户选择哪个相册可供选择。他们是相似的,但不同。你可以从PhotoLibrary进入相机胶卷;您只能从UIImagePickerControllerSourceTypeSavedPhotosAlbum访问相机胶卷。

Reference.

参考。