以类型为NSException

以类型为NSException

当我使用CollectionView启动我的应用程序时:

2016-06-20 20:37:30.640 Projekt A[19055:699202] -[UIViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x7fd1bbfa3ac0
2016-06-20 20:37:30.748 Projekt A[19055:699202] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x7fd1bbfa3ac0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f8d2d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000111854deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f8dbd3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010f821cfa ___forwarding___ + 970
    4   CoreFoundation                      0x000000010f8218a8 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x0000000110baa56c -[UICollectionViewData _updateItemCounts] + 492
    6   UIKit                               0x0000000110bad009 -[UICollectionViewData numberOfSections] + 22
    7   UIKit                               0x0000000110b8ef51 -[UICollectionViewFlowLayout _getSizingInfos] + 445
    8   UIKit                               0x0000000110b90c47 -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 118
    9   UIKit                               0x0000000110b8a3fd -[UICollectionViewFlowLayout prepareLayout] + 273
    10  UIKit                               0x0000000110baac3d -[UICollectionViewData _prepareToLoadData] + 67
    11  UIKit                               0x0000000110bab411 -[UICollectionViewData validateLayoutInRect:] + 53
    12  UIKit                               0x0000000110b5853a -[UICollectionView layoutSubviews] + 199
    13  UIKit                               0x0000000110393980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
    14  QuartzCore                          0x0000000114a4ac00 -[CALayer layoutSublayers] + 146
    15  QuartzCore                          0x0000000114a3f08e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
    16  QuartzCore                          0x0000000114a3ef0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    17  QuartzCore                          0x0000000114a333c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
    18  QuartzCore                          0x0000000114a61086 _ZN2CA11Transaction6commitEv + 486
    19  UIKit                               0x000000011030519b _afterCACommitHandler + 174
    20  CoreFoundation                      0x000000010f7f7c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    21  CoreFoundation                      0x000000010f7f7ba7 __CFRunLoopDoObservers + 391
    22  CoreFoundation                      0x000000010f7ed7fb __CFRunLoopRun + 1147
    23  CoreFoundation                      0x000000010f7ed0f8 CFRunLoopRunSpecific + 488
    24  GraphicsServices                    0x000000011607cad2 GSEventRunModal + 161
    25  UIKit                               0x00000001102d8f09 UIApplicationMain + 171
    26  Projekt A                           0x000000010f6e4292 main + 114
    27  libdyld.dylib                       0x000000011238292d start + 1
    28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)


⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
有人可以帮助我吗?
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

最佳答案

错误是说收集视图的数据源设置为普通的UIViewController,而不是您拥有的实现UICollectionViewDataSource的任何类。

检查数据源的分配方式以及对象的类别。

关于ios - libc++ abi.dylib:以类型为NSException(CollectionView)的未捕获异常终止,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37930023/

10-11 15:47