“Creating an image format with an unknown type is an error” with UIImagePickerController

后端 未结 23 1864
长发绾君心
长发绾君心 2020-11-28 09:08

While choosing an image from the image picker in iOS 10 Swift 3 I am getting an error - Creating an image format with an unknown type is an error



        
23条回答
  •  情话喂你
    2020-11-28 09:42

    This worked for me. Just copy and paste it exactly.

        func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
        // The info dictionary contains multiple representations of the image, and this uses the original.
            let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    
        // Set photoImageView to display the selected image.
         photoImageView.image = selectedImage
    
        // Dismiss the picker.
        dismiss(animated: true, completion: nil)
    }
    

提交回复
热议问题