iOS - 子视图上的 setValue:forUndefinedKey 问题
这看起来像是一个基本的 IB 错误,但事实并非如此。
*** Terminating app due to uncaught execption 'NSUnknownKeyExecption', reason:'[<TrailersViewController 0x585e8e0> setValue:forUndfinedKey:]: this class is not key value coding-compliant for the key myImageView.'
myImageView 不在 TrailersViewController 中,它在 TrailersViewController 上的另一个对象。
myImageView 没有任何 IBOutlet。
第三,推送视图时似乎会遇到这个问题 控制器,但它的对象显示在子视图中。
myImageView 只是对象中的局部变量。
我也做了这个工作,但注意到我的 TrailersViewController 相当泄漏,所以我正在重新组织它以阻止这些泄漏。
我现在很茫然,但我能进入的任何其他方向都会很棒。
This looks like a basic IB error but it hasn't worked out to be.
*** Terminating app due to uncaught execption 'NSUnknownKeyExecption', reason:'[<TrailersViewController 0x585e8e0> setValue:forUndfinedKey:]: this class is not key value coding-compliant for the key myImageView.'
myImageView isn't in TrailersViewController it's in
another object that is on TrailersViewController.myImageView does not have any IBOutlets.
Third it seems that you can have this problem when pushing view
controllers but it's object is shown in a subview.myImageView is just a local variable in the object.
Also I had this working but noticed my TrailersViewController was rather leaky so I'm re-organizing it to stop those leaks.
I'm at a loss at the moment but any other directions I could head in would be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您已将笔尖中的 myImageView 视图关联到 TrailersViewController 内名为 myImageView 的 @property IBOutlet,但您忘记了 @synthesize 此属性。
因此,当运行时尝试使用键值方法将从 nib 加载的 myImageView 对象分配给 myImageView 实例时,如果您没有合成它,则找不到 setter 方法。
It seems like you have associated the myImageView view in the nib to a @property IBOutlet called myImageView inside TrailersViewController, but you have forgot to @synthesize this property.
So when the runtime tries to assign the myImageView object loaded from nib to the myImageView instance using key-value approach it doesn't find the setter method has you didn't synthesize it.