mikaoj / BSImagePicker

A multiple image picker for iOS
MIT License
1.35k stars 380 forks source link

Album List is not showing #347

Open irfanabdulkhaliq opened 1 year ago

irfanabdulkhaliq commented 1 year ago

let options = imagePicker.settings.fetch.album.options imagePicker.settings.fetch.album.fetchResults = [ PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .any, options: options) // PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumFavorites, options: options), PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumSelfPortraits, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumPanoramas, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumVideos, options: options)

    ]

Above code is not working on IOS 16. Anyone who knows how to show album list while selecting photo.

BangGahee commented 1 year ago

Set it up before you present the imagepicker.

let imagePicker = ImagePickerController() imagePicker.settings.selection.max = self.imageCount imagePicker.settings.fetch.assets.supportedMediaTypes = [.image] let options = imagePicker.settings.fetch.album.options imagePicker.settings.fetch.album.fetchResults = [ PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .any, options: options), // PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumFavorites, options: options), PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumSelfPortraits, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumPanoramas, options: options), PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumVideos, options: options) ] self.presentImagePicker(imagePicker, select: { (asset) in ......... }