我使用VisionKit框架来捕获iOS 13中引入的文档,这是一个非常好的捕获文档的框架。但是在这个框架中,导航栏上有两个按钮,导航条上有(Retake )。当我点击那些应用程序时会崩溃,原因如下:
由于异常“NSInternalInconsistencyException”而终止应用程序,原因:“应用程序名为-statusBar或-statusBarWindow on UIApplication:由于不再有状态栏或状态栏窗口,必须更改此代码。请在窗口场景中使用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)
}
}有没有办法解决这个问题,防止它崩溃?
发布于 2019-10-18 06:24:08
这是iOS 13的内部问题。现在它已经在iOS 13.1中解决了,请在iOS 13.1中运行您的项目。会很好的。请检查iOS 13错误修复程序。
https://stackoverflow.com/questions/58395320
复制相似问题