I expected that if I attempted to write to a printer without paper in it (e.g. it just ran out of paper), that I would get an error from the write command.
In the below code, no error is logged. If I set a breakpoint, I am able to verify that writeError is nil.
let zebraConnection = MfiBtPrinterConnection(serialNumber: serialNumber)
DispatchQueue.global(qos: .utility).async(execute: {
if (zebraConnection?.open())! {
.
.
.
var writeError: NSError?
zebraConnection?.write(printReceipt.data(using: String.Encoding.utf8), error: &writeError)
if writeError != nil{
DDLogError("Print to zebra errored with error: \(writeError?.localizedDescription)")
}
zebraConnection?.close()
}
iMZ220 with firmware V73.20.01Z
link-OS v1.4.957 for iOS
What is wrong with my approach?
Thanks,
Del
write doesn't return error for out of paper |
1 Replies
Also should note that putting paper in the printer, causes it to print what was previously sent to the printer. So the writes weren't lost... But I would like a way to communicate to the end user that the printer needs paper.