UICollectionView在Swift 3迁移之后崩溃了?

在我的项目中使用Swift 3转换器之后,在加载UICollectionViewController的子类时,我一直崩溃。 以下是我的代码与收集视图的相关方法。

override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return photos.count } override func collectionView(_ collectionView: UICollectionView, c`enter code here`ellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: tileReuseIdentifier, for: indexPath) as! TileCollectionViewCell cell.captionLabel.text = photos[(indexPath as NSIndexPath).item].caption cell.captionLabel.adjustsFontSizeToFitWidth = true cell.imageView.image = photos[(indexPath as NSIndexPath).item].image cell.layer.cornerRadius = 10 cell.layer.shadowPath = UIBezierPath(roundedRect: cell.frame, cornerRadius: cell.layer.cornerRadius).cgPath return cell } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { return CGSize(width: cellSize, height: cellSize) } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAtIndex indexPath: IndexPath) -> CGFloat { return spacing } override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { let reusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: headerReuseIdentifier, for: indexPath) as! HeaderCollectionReusableView reusableView.setupView() return reusableView } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSize(width: collectionView.frame.width, height: cellSize-20) } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets { return UIEdgeInsetsMake(topMargin, spacing, bottomMargin, spacing) } 

这是崩溃时的堆栈跟踪:

 libswiftFoundation.dylib`static Foundation.IndexPath._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSIndexPath>) -> Foundation.IndexPath: 0x100a549e0 <+0>: stp x20, x19, [sp, #-32]! 0x100a549e4 <+4>: stp x29, x30, [sp, #16] 0x100a549e8 <+8>: add x29, sp, #16 ; =16 0x100a549ec <+12>: mov x19, x0 0x100a549f0 <+16>: cbz x19, 0x100a54a18 ; <+56> 0x100a549f4 <+20>: mov x0, x19 0x100a549f8 <+24>: bl 0x100a7cfd4 ; function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Dead> of Foundation.IndexPath.init (nsIndexPath : __ObjC.NSIndexPath) -> Foundation.IndexPath 0x100a549fc <+28>: mov x20, x0 0x100a54a00 <+32>: mov x0, x19 0x100a54a04 <+36>: bl 0x100abcfe4 ; symbol stub for: objc_release 0x100a54a08 <+40>: mov x0, x20 0x100a54a0c <+44>: ldp x29, x30, [sp, #16] 0x100a54a10 <+48>: ldp x20, x19, [sp], #32 0x100a54a14 <+52>: ret -> 0x100a54a18 <+56>: brk #0x1 

一些search导致我https://bugs.swift.org/browse/SR-2103和https://bugs.swift.org/browse/SR-2417

奇怪的是,当我在上述方法的开始处设置断点时,应用程序在任何断点到达之前崩溃。 viewDidLoad执行并返回。 然后,应用程序崩溃与上述错误。

任何人都可以帮忙吗?