我收到来自 Apple 的崩溃,如下所示:
崩溃报告非常糟糕,正如 Xcode 所预期的那样,我必须猜测它来自代码中的何处。
崩溃涉及弹出窗口。我的代码中唯一有弹出窗口的部分是“共享”内容,当我在显示文档文件夹中的文件的表格 View 上执行这些“删除”和“共享”尾随滑动操作时。
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let delete = ... bla bla bla
let share = UIContextualAction(style: .normal, title: "") {[weak self] (contextualAction, view, boolValue) in
let oneFile = self?.files![indexPath.section]![indexPath.row]
let activityViewController = UIActivityViewController(
activityItems: ["Check out these files.", (oneFile?.url)! as URL],
applicationActivities: nil
)
activityViewController.popoverPresentationController?.sourceView = self?.view
self?.present(activityViewController, animated: true, completion: {[weak self] in
self?.tableView.setEditing(false, animated: true)
})
}
let swipeActions = UISwipeActionsConfiguration(actions: [delete,share])
swipeActions.performsFirstActionWithFullSwipe = true
return swipeActions
}
你们在这里看到什么可能导致崩溃吗?
报告显示它在 iPad 上崩溃,但我测试过,它工作正常。
最佳答案
您应该定义 popoverPresentationController
的 sourceRect
和 sourceView
。
关于ios - UIPopOverPresentationController 在presentationTransitionWillBegin 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62761669/