DKImagePickerController icon indicating copy to clipboard operation
DKImagePickerController copied to clipboard

Fetch Original Image return nil

Open mhdHasanAlgnadi opened this issue 5 years ago • 3 comments

I want to get the images I chose , so I wrote this code

func showImagePicker() {
        let pickerController = DKImagePickerController()
//        self.previewView?.isHidden = false
        pickerController.autoCloseOnSingleSelect = true
        pickerController.assetType = .allPhotos
        pickerController.defaultAssetGroup = .smartAlbumUserLibrary
        pickerController.didSelectAssets = { (assets: [DKAsset]) in
            if  assets.count>0
            {
                for i in 0 ... assets.count-1 {
                    assets[i].fetchOriginalImage { (img, info) in
                        self.abc.append(img!)
                    }
                }
            }
            self.image.image = self.abc[0]
            self.previewView?.reloadData()
        }
        self.present(pickerController, animated: true) {}
    }

As a result of this code, I get the photos I chose in DKAsset format But when I apply Fetch Original Image , I don't get a result and the function does not enter the complition

mhdHasanAlgnadi avatar Dec 22 '19 10:12 mhdHasanAlgnadi

how did you solve this issue???

Aizaz-Abbasi avatar Jun 17 '20 06:06 Aizaz-Abbasi

Unfortunately, I had to change the library to TLPhotoPicker

mhdHasanAlgnadi avatar Jun 17 '20 09:06 mhdHasanAlgnadi

Use this func :fetchImage asset.fetchImage(with: self.view.bounds.size, completeBlock: { image, info in myImageView.image = image }

JsonFu avatar Aug 04 '22 06:08 JsonFu