【发布时间】:2018-04-04 01:19:53
【问题描述】:
为 ImagepickerViewController 调用委托方法时出现此错误
Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
我的委托方法是
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
{
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage
{
UserDefaults.standard.set(UIImagePNGRepresentation(image), forKey: "avatarImage")
}
else
{
//Error message
}
self.dismiss(animated: true, completion: nil)
}
编辑:我尝试了其他问题的答案,但它们没有用
【问题讨论】:
-
不要将图像数据存储在 UserDefaults 中。将图像写入文件。
标签: ios swift uiimagepickercontroller photos userdefaults