Swift 如何加载相机扫描仪?
我得到以下错误:Swift 如何加载相机扫描仪?,swift,xcode,file,pdf,Swift,Xcode,File,Pdf,我得到以下错误: Warning: Attempt to present <VNDocumentCameraViewController_InProcess: 0x109e216c0> on <[myapp]> whose view is not in the window hierarchy! 如何实现此功能?您只能从视图层次结构中已有的视图控制器调用present。因此,请确保您拥有scanDocument函数的视图控制器已首先显示/按下/显示。您从哪里调用scan
Warning: Attempt to present <VNDocumentCameraViewController_InProcess: 0x109e216c0> on <[myapp]> whose view is not in the window hierarchy!
如何实现此功能?您只能从视图层次结构中已有的视图控制器调用
present
。因此,请确保您拥有scanDocument
函数的视图控制器已首先显示/按下/显示。您从哪里调用scanDocument()
。当我点击按钮时,我得到了错误信息。
public func scanDocument() {
let scannerViewController = VNDocumentCameraViewController()
scannerViewController.delegate = self
present(scannerViewController, animated: true)
}