我正在使用此功能直接打印到打印机。第一次打印没问题,但是当我尝试打印另一个文档时出现此错误:
“打印机“EPSON WF-5710”似乎与以前使用的同名打印机不同,或者连接可能不可靠。如果这是预期的,请点击“继续”。
我该如何解决这个问题?这是我用于打印的代码
//MARK: -SEND DOCUMENT TO PRINTER
func printDocument(dataToPrint: Data?){
let printController = UIPrintInteractionController.shared
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = .general
printInfo.jobName = ""
printInfo.printerID = AppSettings.printerURL
printController.printInfo = printInfo
printController.printingItem = dataToPrint ?? Data()
let url = NSURL(string: AppSettings.printerURL)
let printerObj = UIPrinter(url: url! as URL)
printController.print(to: printerObj, completionHandler: nil)
printController.present(animated: true, completionHandler: nil)
}