Creating an image format with an unknown type is an error while capturing image from gallery Swift -
im trying image gallery in swift.
func showpicker(type : uiimagepickercontrollersourcetype) { let imagepicker = uiimagepickercontroller() imagepicker.delegate = self imagepicker.sourcetype = type imagepicker.allowsediting = false self.present(imagepicker, animated: true, completion: nil) }
then:
self.showpicker(type: .savedphotosalbum)
however, when enter gallery on device , pick photo nothing happen, instead in log says : [generic] creating image format unknown type error
how dismiss gallery , save image?
uiimagepickerview
set delegate uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate
let imagepicker = uiimagepickercontroller() //in did load imagepicker.delegate = self // mark: - uiimagepickercontrollerdelegate methods func imagepickercontroller(_ picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : any]) { if let image = info[uiimagepickercontrolleroriginalimage] as? uiimage { imgview.image = image } else{ print("something went wrong") } dismiss(animated: true, completion: nil) }
Comments
Post a Comment