【发布时间】:2017-07-30 17:53:57
【问题描述】:
我有这样的方法:
internal func handlePan(_ sender: UIPanGestureRecognizer) {
if (sender.state == .began) {
let initialPanPoint = sender.location(in: collectionView)
findDraggingCellByCoordinate(initialPanPoint)
} else if (sender.state == .changed) {
let newCenter = sender.translation(in: collectionView!)
updateCenterPositionOfDraggingCell(newCenter)
} else {
if let indexPath = draggedCellPath {
// finishedDragging(collectionView!.cellForItem(at: indexPath)!)
finishedDragging((collectionView?.cellForItem(at: indexPath))!)
}
}
}
我遇到了崩溃
finishedDragging((collectionView?.cellForItem(at: indexPath))!)
致命错误:在展开可选值时意外发现 nil
我怎样才能解开这个? 请帮我。 谢谢。
【问题讨论】:
-
所有其他“意外发现 nil”问题的重复(并且有数千个)。
!表示崩溃。