簡體   English   中英

UIPopOverPresentationController 在presentationTransitionWillBegin 上崩潰

[英]UIPopOverPresentationController crashes on presentationTransitionWillBegin

我收到來自 Apple 的崩潰,如下所示:

在此處輸入圖像描述

崩潰報告太糟糕了,正如 Xcode 所預期的那樣,我不得不猜測我的代碼來自哪里。

崩潰談論popover。 當我在顯示文檔文件夾中的文件的表格視圖上進行這些“刪除”和“共享”尾隨滑動操作時,我的代碼中唯一有彈出框的部分是這個“共享”內容。

 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 上崩潰,但我進行了測試,它工作正常。

您應該定義popoverPresentationControllersourceRectsourceView

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM