The app can create a custom album in the standard iOS photos application, but I have been unable to find a way for the app to gather all the images from that album to be displayed within the app.
Currently, the app is able to gather images from all the albums, just not one is particular.
let resultCollections = PHAssetCollection.fetchAssetCollectionsWithType(
.Album,
subtype: .AlbumRegular,
options: nil)
resultCollections.enumerateObjectsUsingBlock({
(object, index, stop) -> Void in
let collection = object as! PHAssetCollection
let result = PHAsset.fetchAssetsInAssetCollection(collection, options: nil)
result.enumerateObjectsUsingBlock({
(object, index, stop) -> Void in
let asset = object as! PHAsset
self.images.append(asset)
})
})
I have seen other questions that might be marked as duplicates, however the majority of them are talking about opening a UIPickerView to a custom album. This is a possible duplicate of How to fetch all images from custom Photo Album - swift however, it was never answered.
So, how can an iOS app gather all images from a particular photos album?
How to select multiple photos on Android. Selecting all the photos saved locally on an Android phone is a lot easier than doing so on an iPhone: On stock Android, open the Files app and go to Images, tap the three dots in the top right corner of your screen, and hit Select all.
Touch and hold a photo, and then select the photos you want in your new album. Select Album. Optional: Add a title to your new album.
Use albums in the Photos app to view and organize your photos and videos. Tap Albums to view your photos and videos organized into different categories and media types, like Videos, Portrait, and Slo-mo.
Add fetchOptions like below
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "title = %@", YourAlbumTitle)
let resultCollections = PHAssetCollection.fetchAssetCollectionsWithType(.Album, subtype: .AlbumRegular, options: fetchOptions)
Actually, album title isn't unique value, they can duplicate. so I recommend use localIdentifier like below, if your app access multiple albums.
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "localIdentifier = %@", YourAlbumLocalIdentifier)
let resultCollections = PHAssetCollection.fetchAssetCollectionsWithType(.Album, subtype: .AlbumRegular, options: fetchOptions)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With