-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I need the whole printing feature in the background queue and I am running printing code in the background using the following functions:
DispatchQueue.background(delay: 0, attributes: .concurrent, background: {
globalGroup.enter()
self.printOrdersOnNotification()
})
and the following function starts the printing on Background Queue:
func printDocketsForOrder(order: PrintableOrder) {
print("Print orders from here...")
self.printList = [PrintableOrder]()
let printableOrder = order
for printer in self.printerList {
if printer.locationOfPrinter == printableOrder.docketType {
printerManagement.initializePrinterObject()
self.printerTarget = printer.printerTarget
print(printerManagement.printerTarget)
let printerIsConnected = printerManagement.connectPrinter()
if printerIsConnected == true {
//Print Docket for that particular order
let printOrder = printableOrder
printerManagement.printList.append(printOrder)
isPrinterSequenceRunning = printerManagement.runPrinterSequence()
}
else {
print("Printer is not connected...")
globalGroup.leave()
}
}
}
}
But the issue is that, I am always getting its callback -
func onPtrReceive(_ printerObj: Epos2Printer!, code: Int32, status: Epos2PrinterStatusInfo!, printJobId: String!)
on the main thread, instead of getting a call back on the background queue.
Any help would be appreciated.