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

后端 未结 23 1862
长发绾君心
长发绾君心 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:51

    Below mentioned code did solve the problem for me -

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
        if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
            imagePost.image = image
        } else{
            print("Something went wrong")
        }
    
        self.dismiss(animated: true, completion: nil)
    }
    

提交回复
热议问题