quot;Creating an image format with an unknown type is an errorquot; with UIImagePickerController(“创建具有未知类型的图像格式是错误的与 UIImagePickerController)
问题描述
在 iOS 10 Swift 3 中从图像选择器中选择图像时出现错误 - 使用未知类型创建图像格式是错误
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
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
imagePost.image = image
self.dismiss(animated: true, completion: nil)
}
图像未被选中和更新.我需要帮助或建议以了解 iOS10 或 Swift 3 中的语法或有关此方法的任何内容是否已更改,或者是否有任何其他方法可以做到这一点.
The image is not getting selected and updated. I need help or suggestion to know if the syntax or anything regarding this method has been changed in iOS10 or Swift 3 or is there any other way to do this.
推荐答案
下面提到的代码确实为我解决了问题 -
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)
}
这篇关于“创建具有未知类型的图像格式是错误的"与 UIImagePickerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“创建具有未知类型的图像格式是错误的"与 UIImagePickerController
基础教程推荐
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01