I want to set image to my UIImageView
in imagePickerController
with using Kingfisher
but nothing happens. First i direct the user to the photo library. After the user selects the photo and comes back, i get the photo as UIImage
and the an URL
in imagePickerController
. Kingfisher does not have a method to set UIImage
. So i try to set it from URL but i just see empty an UIImageView
. My code is;
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let changedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
let url = info[UIImagePickerControllerReferenceURL] as! URL
profilePhotoImage.kf.setImage(with: url)
picker.dismiss(animated: true, completion: nil)
}
My url is, "assets-library://asset/asset.JPG?id=D21C7124-472A-44F8-A22B-B3A5A0C48E32&ext=JPG" 0x00000001702f7680"
. Is there anything wrong with my URL or can i set UIImage
with kingfisher. I'm sure i can get the photo because when i try to set that changedImage
without kf
it works. I tried the
Kingfisher and swift 3 - cannot set image with url but it didn't work.
Yeah you are right. It is really so strange.
Try to set your changed image on picker dismiss method's completion. maybe it will work:
picker.dismiss(animated: true, completion: nil)
self.imageView.image = self.changedImage
}