iOS - xib死活连不上代码问题/[ setValue:forUndefinedKey:]: this class is not key

今天遇到一个问题:新建的xib文件连接不上代码。

解决方法:

iOS - xib死活连不上代码问题/[<NSObject 0x1702023e0> setValue:forUndefinedKey:]: this class is not key

这个file’s Owner 的Custom Class 设置为自己的类名,终于可以把xib的控件拖到代码里了,但随后运行之后出现:
[ setValue:forUndefinedKey:]: this class is not key

直接崩溃了。。

解决方法:

iOS - xib死活连不上代码问题/[<NSObject 0x1702023e0> setValue:forUndefinedKey:]: this class is not key

然后再把刚才的这个file’s Owner 的Custom Class清空。

至于,直接设置Home Record Recommend Reusable View 也就是我们创建的xib的Custom Class 能否可以直接解决xib连接不上代码的问题,我没有去考证,如果你遇到这个问题的时候可以先试一试。