I need to display the camera roll album with the count of images in it. I'm using the below code to get the camera roll album.
let smartCollections = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .SmartAlbumUserLibrary, options: nil)
smartCollections.enumerateObjectsUsingBlock { object, index, stop in
if let collection = object as? PHAssetCollection {
print(collection.estimatedAssetCount)
}
}
I have only 28 images in the camera roll in the Photos app. But the estimatedAssetCount
property returns the value 9223372036854775807!
This only happens for OS created albums like the camera roll. For user created regular albums, the correct value is returned. Am I doing anything wrong or is this a bug?
If it is, is there any other way to get the correct image count?