QuickLook -> _BSMachError: (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

When I present the QLPreviewController() for the second time, third time, etc. I'm getting this error.


2019-02-05 16:37:26.862843+0100 *** [43475:12434566] [Common] _BSMachError: port 8817; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"


The port number is always different.


Here is my code:

(model selected is a string containing the usdz file name)



override func viewDidAppear(_ animated: Bool) {

presentQuicklook()

}


@objc func presentQuicklook() {

let previewViewController = QLPreviewController()

previewViewController.dataSource = self

previewViewController.delegate = self

present(previewViewController, animated: true, completion: nil)

}



extension QuickLookVC: QLPreviewControllerDelegate, QLPreviewControllerDataSource {



func previewController(_ controller: QLPreviewController, transitionViewFor item: QLPreviewItem) -> UIView? {

return self.view

}


func numberOfPreviewItems(in controller: QLPreviewController) -> Int {

return 1

}


func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {

let fileUrl = Bundle.main.url(forResource: modelSelected, withExtension: "usdz")!

return fileUrl as QLPreviewItem

}


}

Replies

Sometimes it doesn't load the model. This is the error:


2019-02-05 17:07:06.334000+0100 *** [43497:12458153] [default] Quick Look extension view service did terminate with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} #Remote

2019-02-05 17:07:06.339037+0100 Bianchi&Nardi[43497:12459806] [default] Error calling service: Couldn’t communicate with a helper application. #Remote

2019-02-05 17:07:06.353283+0100 *** [43497:12458153] [default] QLItemViewController (contents: file:///var/containers/Bundle/Application/C525AF15-A265-4725-B566-A376105D2919/***.app/Valeria.usdz) did fail with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}. #PreviewCollection