'NSInternalInconsistencyExce
2015-12-16 本文已影响2920人
蛐蛐_
这是当你在俩个xib view 用viewController 进行跳转的时候会遇到的问题,解决方法如下:

点击xib文件,在这下面这个地方让xib文件和LoginVIew相关联

2.然后点击这个File's Owner 图4设置你要加载到xib view到的那个viewController上,这里不要用下面图3这种方式了,在viewController.m文件中可以什么也不用写,下面我告诉大家原因。


在此处设置 File's Owner 与viewController相关联

3.此时右键File's Owner 会 出现一个view 你把他和你的xib view 连线就可以了。

4.直接CMD + R,运行程序即可。
我说说为什么用图3那种方式会报错,因为当你用了连线相关联以后就已经把viewController本身自带的view同化成你xib的view了,所以你加载时用图3方式加载到viewController,就会报另外一个错误。
'NSUnknownKeyException', reason: '[<NSObject 0x7f8d7a83e7f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.
解决方法:把图3加载视图的方式删除即可