0

I get an error saying

*** 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) 

Why does this happen and how can I fix it?

4

2 回答 2

2

When you’re using a UICollectionViewController, the view outlet needs to be connected to a UICollectionView in your storyboard; if it’s a UIView of another class, it’ll crash.

于 2013-08-17T02:26:40.610 回答
0

checkHatsViewController.h是继承自,UICollectionViewController但您已在情节提要中连接了它的视图。它要么必须是子类,UIViewController要么连接到情节提要中的 UICollectionView。

于 2013-08-17T05:18:39.683 回答