Crash with UIPrintOptionsTableViewController

UIPrintInteractionController crashed when I use it to print a html content.

Fatal Exception: NSInternalInconsistencyException
UITableView dataSource returned a nil cell for row at index path: <NSIndexPath: 0x938e90f84baaa518> {length = 2, path = 1 - 0}. Table view: <UITableView: 0x107991000; frame = (0 0; 375 419); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x2846b0000>; backgroundColor = <UIDynamicSystemColor: 0x281d2e400; name = systemGroupedBackgroundColor>; layer = <CALayer: 0x2848aa480>; contentOffset: {0, -56}; contentSize: {375, 357.0830078125}; adjustedContentInset: {56, 0, 0, 0}; dataSource: <UIPrintOptionsTableViewController: 0x107973800>>, dataSource: <UIPrintOptionsTableViewController: 0x107973800>

here is the code

    private let webView = WKWebView()
    private let printController = UIPrintInteractionController.shared
    func showPrintView(encodedHtml: String) {
        printController.delegate = self
        let decodedHtmlString = base64Decode(encodedHtml)
        webView.loadHTMLString(decodedHtmlString, baseURL: nil)
        
        loadPrint()
    }
    
    private func loadPrint() {
        let printInfo = UIPrintInfo(dictionary: nil)
        printInfo.orientation = .landscape
        printController.printInfo = printInfo
        printController.printFormatter = webView.viewPrintFormatter()
        
        Timer.scheduledTimer(withTimeInterval: 0.6, repeats: false) { _ in
            self.printController.present(animated: true) { _, _, error in
                guard let error = error else { return }
                self.error = error
            }
        }
    }
    
    private func base64Decode(_ text: String) -> String {
        if let restoreData = Data(base64Encoded: text) {
            if let restoreString = String(data: restoreData, encoding: .utf8) {
                return restoreString
            }
        }
        return ""
    }

I'm sure did nothing with UIPrintOptionsTableViewController so I have no idea how did this crash happened and how to fix it. Can someone help me?

same error and very much

Hi, did you ever figure this out? We've also recently started getting this crash intermittently.

Crash with UIPrintOptionsTableViewController
 
 
Q