iPad 在 Tableview 单元格上长扫崩溃

Long Swipe on Tableview cell crashes in iPad

我有一个实施了编辑操作的表格视图。当在 tablecell 上向左滑动时,它会显示 "Options" 文本,点击 "Options" 会显示带有几个选项的警报视图。这在 iPhone

中非常有效

但在 iPad 中,只有当我缓慢地滑动到一定程度时,这才有效。如果我用力滑动/长时间滑动,它会使我的应用程序崩溃。

它因 SIGABART 错误而崩溃,即使我有异常断点也没有捕获。不知道为什么会这样。请指教

我假设问题出在 self.present..不过不确定

DispatchQueue.main.async {
            self.addAlertForiPad(alert: alertController)
            self.present(alertController, animated: true, completion: nil)
        }

    public func addAlertForiPad(alert: UIAlertController) {
        DispatchQueue.main.async {
            if let popoverPresentationController = alert.popoverPresentationController {
                popoverPresentationController.sourceView = self.view
                popoverPresentationController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
                popoverPresentationController.permittedArrowDirections = []
            }
        }
    }

您在执行这些操作时是否查看了 cpu/ram 用法?也许您的 ipad 太旧了,无法支持在 TableView 中快速滚动...您能否发送定义每个单元格的代码,这将很有帮助

能否尝试从这个“addAlertForiPad(alert: UIAlertController)”中删除“DispatchQueue.main.async”?