简体   繁体   English

在iPad上长时间滑动Tableview单元会导致崩溃

[英]Long Swipe on Tableview cell crashes in iPad

I have a tableview with edit actions implemented. 我有一个实现了编辑动作的tableview。 When swiped left on tablecell, it shows "Options" text and on tap of "Options" it displays alert view with few options. 在表格单元格上向左滑动时,它会显示“选项”文本,在点击“选项”时,它将显示带有很少选项的警报视图。 This works perfectly in iPhone 这在iPhone中完美工作

But in iPad this works only if I swipe slowly and just to an extend. 但是在iPad中,只有当我缓慢滑动并延伸到一定程度时,此方法才起作用。 If I swipe hard / do long swipe it crashes my app. 如果我用力滑动/长时间滑动,则会使我的应用程序崩溃。

It crashes with SIGABART error without catching even if I have Exception break point. 即使我有Exception断点,它也会因SIGABART错误崩溃而无法捕获。 Not sure why this is happening. 不知道为什么会这样。 Please advice 请指教

Im assuming the issue is with self.present..not sure though 我假设问题出在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 = []
            }
        }
    }

Did you look at the cpu/ram usage when you were doing these ? 在执行这些操作时,您是否查看过CPU / RAM的使用情况? Maybe your ipad is too old and is not able to support a fast scroll in a TableView... And can you send the code who define each cell please, it would be helpfull 也许您的ipad太旧了,无法在TableView中支持快速滚动...并且可以发送定义每个单元格的代码,这将对您有所帮助

您可以尝试从此“ addAlertForiPad(警告:UIAlertController)”中删除“ DispatchQueue.main.async”吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM