移动视图控制器时出错

时间:2013-08-17 02:24:28

标签: ios xcode uiviewcontroller

我收到错误说

*** Assertion failure in -[HatsViewController loadView], /SourceCache/UIKit/UIKit-2380.17/UICollectionViewController.m:104    

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "FCD-ki-UFO-view-1vb-8P-s3C" nib but didn't get a UICollectionView.'
    *** First throw call stack:
    (0x3467c2a3 0x3c36097f 0x3467c15d 0x34f51ab7 0x368aaa95 0x364a346d 0x3652f353 0x36570d11 0x3656ffe7 0x366923ef 0x3656f0c5 0x3656f077 0x3656f055 0x3656e90b 0x3656ee01 0x364975f1 0x36484801 0x3648411b 0x3818b5a3 0x3818b1d3 0x34651173 0x34651117 0x3464ff99 0x345c2ebd 0x345c2d49 0x3818a2eb 0x364d8301 0xc0dfd 0x3c797b20)
    libc++abi.dylib: terminate called throwing an exception
    (lldb) 

为什么会发生这种情况,我该如何解决?

2 个答案:

答案 0 :(得分:2)

当您使用UICollectionViewController时,view出口需要连接到故事板中的UICollectionView;如果它是另一个类的UIView,它就会崩溃。

答案 1 :(得分:0)

支票HatsViewController.h继承自UICollectionViewController,但您已在故事板中连接了该视图。它必须是UIViewController的子类,或者它连接到故事板中的UICollectionView。