IDE:- Xcode 13.4.1, Chip:- M1 chip, Swift 5, Tested on iOS 15.5
I am using below code for printing, Print and Cancel was working before but with the new build the buttons are sometimes unresponsive. There is no code change I have compared it with my source control. How can I solve this issue?
if UIPrintInteractionController.canPrint(URL(fileURLWithPath: pdfFilePath)) {
let printInfo = UIPrintInfo(dictionary: nil)
printInfo.jobName = "Print Invoice"
printInfo.outputType = .photo
let printController = UIPrintInteractionController.shared
printController.printInfo = printInfo
printController.showsNumberOfCopies = true
printController.printingItem = URL(fileURLWithPath: pdfFilePath)
printController.present(animated: true, completionHandler: nil)
}
else
{
print("Not able to print")
}