Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 拖放;Drop-in CollectionView:PBItemCollectionService连接已断开_Swift - Fatal编程技术网

Swift 拖放;Drop-in CollectionView:PBItemCollectionService连接已断开

Swift 拖放;Drop-in CollectionView:PBItemCollectionService连接已断开,swift,Swift,我正在尝试实现拖放。以下是我正在使用的方法: func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { // This just gets the view model for the cell at that indexPath let

我正在尝试实现
拖放
。以下是我正在使用的方法:

func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
        // This just gets the view model for the cell at that indexPath
        let rackModel = adapter.object(atSection: indexPath.section) as! RoomListData.RackModel

        // My RackModel class conforms to NSItemProviderWriting and Reading
        let itemProvider = NSItemProvider(object: rackModel)
        let dragItem = UIDragItem(itemProvider: itemProvider)
        return [dragItem]
}

func collectionView(_ collectionView: UICollectionView, itemsForAddingTo session: UIDragSession, at indexPath: IndexPath, point: CGPoint) -> [UIDragItem] {
        let rackModel = adapter.object(atSection: indexPath.section) as! RoomListData.RackModel
        let itemProvider = NSItemProvider(object: rackModel)
        let dragItem = UIDragItem(itemProvider: itemProvider)
        return [dragItem]
}

func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) {
    // This isn't being called  
    print("okay")
}


func collectionView(_ collectionView: UICollectionView, dragPreviewParametersForItemAt indexPath: IndexPath) -> UIDragPreviewParameters? {
        let preview = UIDragPreviewParameters()
        preview.backgroundColor = .clear
        return preview
}
我还为
UICollectionView
设置了
dropDelegate
dragDelegate
。 拖动是可行的,但是当我放下对象时,我在控制台中得到了这个消息(并且没有调用
performDrop
方法):

PBItemCollectionService连接已断开

这是什么?它发生在模拟器上,也发生在我的iPad上。我找不到问题


谢谢你的帮助!如果你需要更多的信息,请告诉我。我不知道调试这个需要什么。

看来记录的消息与您的问题无关,嗯,那么还有其他问题。我要再看一次把这个项目拿出来