In preview, the 3D model is visible in the background but once the camera button is pressed the image in the screenshot is just the 3D model with a black background which is also saved. QLPreviewController implementation:
`func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
thumbnailIndex = indexPath.item
let previewController = QLPreviewController()
previewController.dataSource = self
previewController.delegate = self
present(previewController, animated: true)
}
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
let url = Bundle.main.url(forResource: models[thumbnailIndex], withExtension: "usdz")!
return url as QLPreviewItem
}`
console output is:
2021-10-07 21:26:30.567439+0200 CPARTest[522:28543] Writing analzed variants.
2021-10-07 21:26:30.620474+0200 CPARTest[522:28738] Metal GPU Frame Capture Enabled
2021-10-07 21:26:30.621447+0200 CPARTest[522:28543] Writing analzed variants.
2021-10-07 21:26:30.623724+0200 CPARTest[522:28738] Metal API Validation Enabled
<SCNNode: 0x280e04d00 | no child> -> <ARImageAnchor: 0x2809085b0 identifier="64834AA5-7912-1102-CCC2-77992D9D8FE0" transform=<translation=(0.239411 -0.028021 0.027675) rotation=(84.68° -98.90° -2.02°)> referenceImage=<ARReferenceImage: 0x281600a80 name="cake" physicalSize=(0.050, 0.050)> tracked=YES>
2021-10-07 21:26:34.972808+0200 CPARTest[522:28772] [Session] ARSession <0x104c1ff70>: ARSessionDelegate is retaining 11 ARFrames. This can lead to future camera frames being dropped.
2021-10-07 21:26:34.989003+0200 CPARTest[522:28741] [Session] ARSession <0x104c1ff70>: ARSessionDelegate is retaining 12 ARFrames. This can lead to future camera frames being dropped.
2021-10-07 21:26:35.006186+0200 CPARTest[522:28772] [Session] ARSession <0x104c1ff70>: ARSessionDelegate is retaining 13 ARFrames. This can lead to future camera frames being dropped.
2021-10-07 21:26:35.023000+0200 CPARTest[522:28750] [Session] ARSession <0x104c1ff70>: ARSessionDelegate is retaining 14 ARFrames. This can lead to future camera frames being dropped.
2021-10-07 21:26:35.039644+0200 CPARTest[522:28739] [Session] ARSession <0x104c1ff70>: ARSessionDelegate is retaining 15 ARFrames. This can lead to future camera frames being dropped.
2021-10-07 21:26:35.537424+0200 CPARTest[522:28741] [default] [self.extensionContext conformsToProtocol:auxHostProtocol.protocol] - /Library/Caches/com.apple.xbs/Sources/ExtensionFoundation/ExtensionKit-49.1/ExtensionFoundation/Source/NSExtension/NSExtensionSupport/EXExtensionContext.m:332: Class QLPreviewExtensionHostContext does not conform to aux host protocol: QLRemotePreviewHost