如何加载相机扫描仪?



我收到以下错误:

Warning: Attempt to present <VNDocumentCameraViewController_InProcess: 0x109e216c0> on <[myapp]> whose view is not in the window hierarchy!

调用我的函数时:

public func scanDocument() {
let scannerViewController = VNDocumentCameraViewController()
scannerViewController.delegate = self
present(scannerViewController, animated: true)
}

我怎样才能做到这一点?

您只能从视图层次结构中已有的视图控制器调用present。因此,请确保您具有scanDocument功能的视图控制器已经首先呈现/推送/可见。

最新更新