迅速5错误中的JSON“类型为“任何”的值没有下标”

时间:2019-05-27 15:39:35

标签: ios swift uicollectionview sigabrt

我正在尝试制作一些新的详细信息收集视图,但是对于错误消息我有一些困难。我得到了“线程1:信号SIGABRT”。我应该为这段代码做什么?

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
     return CGSize(width: view.frame.width, height: 170)
}
2019-05-27 22:36:14.252439+0700 elibrary[20316:576411] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
2019-05-27 22:36:16.421260+0700 elibrary[20316:576411] *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.103.12/UICollectionView.m:5417
2019-05-27 22:36:16.427927+0700 elibrary[20316:576411] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier header - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000112a536fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x00000001105f7ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000112a53482 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x0000000110045927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    4   UIKitCore                           0x0000000115d6c9f9 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 2498
    5   UIKitCore                           0x0000000115d6cc2d -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
    6   elibrary                            0x000000010fcea12b $s8elibrary19AppDetailControllerC14collectionView_33viewForSupplementaryElementOfKind2atSo020UICollectionReusableF0CSo0nF0C_SS10Foundation9IndexPathVtF + 363
    7   elibrary                            0x000000010fcea2a8 $s8elibrary19AppDetailControllerC14collectionView_33viewForSupplementaryElementOfKind2atSo020UICollectionReusableF0CSo0nF0C_SS10Foundation9IndexPathVtFTo + 200
    8   UIKitCore                           0x0000000115d58374 -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:] + 521
    9   UIKitCore                           0x0000000115d5c447 -[UICollectionView _updateVisibleCellsNow:] + 4515
    10  UIKitCore                           0x0000000115d61bb6 -[UICollectionView layoutSubviews] + 365
    11  UIKitCore                           0x00000001169ad9c1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1417
    12  QuartzCore                          0x0000000117f1eeae -[CALayer layoutSublayers] + 173
    13  QuartzCore                          0x0000000117f23b88 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396
    14  QuartzCore                          0x0000000117f2fee4 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 72
    15  QuartzCore                          0x0000000117e9f3aa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 328
    16  QuartzCore                          0x0000000117ed6584 _ZN2CA11Transaction6commitEv + 608
    17  UIKitCore                           0x00000001164d9d8a _UIApplicationFlushRunLoopCATransactionIfTooLate + 150
    18  UIKitCore                           0x00000001165ccf5f __handleEventQueueInternal + 6845
    19  CoreFoundation                      0x00000001129babe1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    20  CoreFoundation                      0x00000001129ba463 __CFRunLoopDoSources0 + 243
    21  CoreFoundation                      0x00000001129b4b1f __CFRunLoopRun + 1231
    22  CoreFoundation                      0x00000001129b4302 CFRunLoopRunSpecific + 626
    23  GraphicsServices                    0x000000011a0f12fe GSEventRunModal + 65
    24  UIKitCore                           0x00000001164dfba2 UIApplicationMain + 140
    25  elibrary                            0x000000010fcf2c8b main + 75
    26  libdyld.dylib                       0x0000000113c8a541 start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

0 个答案:

没有答案