我正在尝试构建一个简单的应用程序来扫描文档,但在尝试导入VisionKit模块时遇到此错误,我如何解决此错误?

我的代码:
import UIKit
import VisionKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func openCameraButtonTaped(_ sender: Any) {
configureDocumentView()
}
private func configureDocumentView() {
let scaningDocumentViewController = VNDocumentCameraViewController()
scaningDocumentViewController.delegate = self
self.present(scaningDocumentViewController, animated: true, completion: nil)
}
}
extension ViewController: VNDocumentCameraViewControllerDelegate {
func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
for pageNum in 0..<scan.pageCount {
let image = scan.imageOfPage(at: pageNum)
print(image)
}
controller.dismiss(animated: true, completion: nil)
}
}发布于 2021-11-28 22:20:58
你给编译器带来了困难,你的项目名称与苹果的VisionKit冲突。使用不同的名称创建新的项目。
https://stackoverflow.com/questions/70144927
复制相似问题