从图库Swift中捕获图像时,创建具有未知类型的图像格式是一个错误

时间:2017-08-18 08:07:42

标签: swift

我试图从Swift的画廊中获取图像。

 func showPicker(type : UIImagePickerControllerSourceType) {
        let imagePicker =  UIImagePickerController()
        imagePicker.delegate = self
        imagePicker.sourceType = type
        imagePicker.allowsEditing = false
        self.present(imagePicker, animated: true, completion: nil)
    }

然后:

        self.showPicker(type: .savedPhotosAlbum)

然而,当我在我的设备上输入图库并选择照片时,没有任何事情发生,而是在日志中说:[Generic] Creating an image format with an unknown type is an error

如何关闭图库并保存图像?

1 个答案:

答案 0 :(得分:4)

data.result.url

设置委托UIImagePickerControllerDelegate,UINavigationControllerDelegate

UIImagepickerView