VisionKit框架iOS 13中的iOS应用程序崩溃

VisionKit框架iOS 13中的iOS应用程序崩溃,ios,swift,ios13,visionkit,Ios,Swift,Ios13,Visionkit,我正在使用iOS 13中引入的VisionKit框架进行文档捕获。这是一个完美的文档捕获框架。但在这个框架中,导航栏上有两个按钮(重拍并完成)。当我点击这些应用程序时,其崩溃原因如下:- 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“UIApplication上调用了-statusBar或-statusBarWindow的应用程序:必须更改此代码,因为不再存在状态栏或状态栏窗口。改用窗口场景中的statusBarManager对象。“

我正在使用iOS 13中引入的VisionKit框架进行文档捕获。这是一个完美的文档捕获框架。但在这个框架中,导航栏上有两个按钮(重拍并完成)。当我点击这些应用程序时,其崩溃原因如下:-

由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“UIApplication上调用了-statusBar或-statusBarWindow的应用程序:必须更改此代码,因为不再存在状态栏或状态栏窗口。改用窗口场景中的statusBarManager对象。“

我试图通过将preferredStatusBarUpdateAnimation返回为false来实现这一点。但这并没有解决

下面是代码片段:-

import UIKit
import VisionKit

class DetectDocumentViewController: UIViewController, VNDocumentCameraViewControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    @IBAction func tapMeAction(_ sender: UIButton) {
        let vc = VNDocumentCameraViewController()
        vc.delegate = self
        present(vc, animated: true)
    }

    func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
        print("Found \(scan.pageCount)")

        for i in 0 ..< scan.pageCount {
            let img = scan.imageOfPage(at: i)
            print(img)
            // ... your code here
        }
        controller.dismiss(animated: true, completion: nil)
    }

    func documentCameraViewControllerDidCancel(_ controller: VNDocumentCameraViewController) {
        controller.dismiss(animated: true)
    }

    func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFailWithError error: Error) {
        print(error)
        controller.dismiss(animated: true)
    }
}
导入UIKit
导入VisionKit
类DetectDocumentViewController:UIViewController、VNDocumentCameraviewController和Elegate{
重写func viewDidLoad(){
super.viewDidLoad()
}
@iAction func tapMeAction(\发送方:UIButton){
设vc=VNDocumentCameraViewController()
vc.delegate=self
当前(vc,动画:真)
}
func documentCameraViewController(u控制器:VNDocumentCameraViewController,通过扫描完成:VNDocumentCameraScan){
打印(“找到\(scan.pageCount)”)
对于0中的i..

有没有办法解决此问题以防止其崩溃?

这是iOS 13内部问题。现在它已在iOS13.1中解决,请在iOS 13.1中运行您的项目。它会很好用的。请检查iOS 13错误修复。

显示导致崩溃的代码行。@EmilioPelaez它不会因为我的代码行而崩溃。当我点击导航栏上的“完成”或“重拍”按钮时,它会崩溃,该按钮在VNDocumentCameraViewController出现后显示。要生成它,请尝试在XCode项目中实现上述代码。我认为这是VisionKit框架的内部崩溃。