I have a small question. We want the user to the able to choose an image from his device’s library. If he has more albums apart from the camera roll, we use UIImagePickerControllerSourceTypePhotoLibrary, so he could browse all the albums. The problem comes when he only has the camera roll. In that case we want him to go directly to the camera roll screen, instead of showing an albums table with the camera roll as only choice. It is an useful step.
The question: Is there way to know that there is only one album (camera roll) in the device, so we use UIImagePickerControllerSourceTypeSavedPhotosAlbum and skip that intermediate case?
Is there any other solution?
Thanks a lot.
You can use the
ALAssetsLibrarymethodenumerateGroupsWithTypes:usingBlock:failureBlock:to iterate over all albums in the photo library. It doesn’t give you the count directly so you would have to increment your own counter but it should give you the desired result.Check the documentation for
enumerateGroupsWithTypes:usingBlock:failureBlock:for more info on the method.