Swift 中的 Image Picker 错误“此类不符合键的键值编码" [英] Error With Image Picker in Swift "this class is not key value coding-compliant for the key"

查看:55
本文介绍了Swift 中的 Image Picker 错误“此类不符合键的键值编码"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试在 Swift 中创建图像选择器时,用户按下按钮并选择图像时,我遇到了以下错误:

While trying to create an image picker in Swift, where the user presses the button and chooses an image, I came across this error:

'NSUnknownKeyException', reason: '[<MemeGenerator.ViewController 0x7ff3805a6f10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key selectedImage.'

我的视图控制器类是这里

知道出了什么问题吗?如果需要,我可以提供更多文件.

Any idea what's wrong? I can provide more of the files if necessary.

推荐答案

通常该消息意味着您在 IB(接口生成器)中的控件和代码中定义的 IBOutlet 之间连接了一个 IBOutlet 链接,然后删除了该插座.在运行时,当系统尝试连接链接时失败.

Usually that message means that you connected an IBOutlet link in IB (Interface Builder) between a control and a defined IBOutlet in your code and then deleted the outlet. At runtime when the system tries to hook up the link it fails.

查看 IB 视图控制器中的所有出口(以及 IBActions)并查找损坏的链接.

Look through all the outlets (and IBActions too) in your view controller in IB and look for broken links.

这篇关于Swift 中的 Image Picker 错误“此类不符合键的键值编码"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆