write doesn't return error for out of paper

D Del Brown 3 years 7 months ago
6 1 0

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

Please Register or Login to post a reply

1 Replies

D Del Brown

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.

CONTACT
Can’t find what you’re looking for?