报错:this class is not key value coding-compliant for the key closeLotTextField解决方法

Posted itianyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报错:this class is not key value coding-compliant for the key closeLotTextField解决方法相关的知识,希望对你有一定的参考价值。

几种情况下都会报这种错误:

1,加载自定义的tableViewCell的时候总是死在:

        XInstrumentOpenCell *cell = [tableViewdequeueReusableCellWithIdentifier:CellTableIdentifier];


log里面报错:this class is not key value coding-compliant for the key closeLotTextField


解决方法:

因为xib的属性检查器中,没有设置Identifier为cellID

    static NSString *CellTableIdentifier = @"cellID";

2,在加载WorkingOrder界面的时候,总是报这个错误:

解决方法:

因为在xib的连接中,有一个变量stateLabel是已经删除了的(用phaseLabel代替了)。虽然代码已经删除了,但是连线还是存在于xib文件中。

删掉这个多余的连接线就好了。


3,检查代码拼写,有时候改了类的名字,但是有些地方没有改过来,就会一直报这种错误,比如

NSArray *secondLevelObjects = [[NSBundlemainBundle] loadNibNamed:@"XOpenPositionContentCell"owner:nil options:nil];

重点是字串中的类名,一般使用类名定义的时候很好找出来改掉,但是写在字串里面的不容易被发现


4,连线的时候选择的是cell 不是file‘s owner,有时候设置了xib文件的class,但是项目未更新过来,重启xcode。


以上是关于报错:this class is not key value coding-compliant for the key closeLotTextField解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Terminating app due to uncaught exception 'NSUnknownKeyException' this class is not key valu

iOS: setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name.(示例代码

this.$el.querySelectorAll is not a function报错解决

this.$el.querySelectorAll is not a function报错解决

this.$el.querySelectorAll is not a function报错解决

this.$el.querySelectorAll is not a function报错解决