In printing via the iOS SDK to a Zebra ZQ510 Bluetooth printer, some jobs are executed and others seem to disappear without any error or information about why the printer hasn't printed the job.
The pertinent code can be found here: Zebra ZQ510 Print Job · GitHub. We currently use two other printers (Infinite Peripherals DPP-350C and Star TSP650II), but I've tried to remove references to those in the code sample to avoid confusion.
I can continually call the -(void)printZebraSelfTest method with high rates of success. When I try to call the -(BOOL)printReceipt:(Order *)order method, it works about 90% of the time. Calling -(BOOL)printTickets:(Order *)order works less than 25% of the time. Sometimes, when the printTickets method is called, only the nested call to printReceipt prints out on paper.
The view controllers that execute prints do so in the following manner:
- (void)printReceiptAction { [SVProgressHUD showWithStatus:@"Printing Receipt..." maskType:SVProgressHUDMaskTypeBlack]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [VP_APPDELEGATE.devices printReceipt:self.order]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss]; }); }); } - (void)printTicketsAction { [SVProgressHUD showWithStatus:@"Printing Tickets..." maskType:SVProgressHUDMaskTypeBlack]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [VP_APPDELEGATE.devices printTickets:self.order]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss]; }); }); }
Sometimes, I get the following output in my log:
2015-10-19 20:41:44.559 PrintApp[3160:223372] Printing receipt... 2015-10-19 20:41:44.637 PrintApp[3160:223372] ZEBRA: Language error: (null) 2015-10-19 20:41:45.569 PrintApp[3160:223372] ZEBRA: Connection error: (null) 2015-10-19 20:41:45.772 PrintApp[3160:222559] Unable to get scanner info! 2015-10-19 20:41:45.785 PrintApp[3160:222559] Zebra mobile printer connected! 2015-10-19 20:41:45.797 PrintApp[3160:223372] ZEBRA: Graphics error: Error Domain=ZSDK_API_ERROR_DOMAIN Code=0 "The connection is not open" UserInfo=0x16cb6b70 {NSLocalizedDescription=The connection is not open} 2015-10-19 20:41:45.802 PrintApp[3160:223372] [PRINT STRING]: ^XA^POI^PW576^MNN^LL695^LH0,0^FO50,10^XGE:LOGO_V5.GRF,1,1^FS^A2,N,24,24^FO30,160^FD RECEIPT ONLY^FS^A2,N,12,12^FO20,220^FDTERMINAL 002 10/19/2015 20:34:28 PM^FS^A2,N,12,12^FO20,245^FDOrder Number: APP-002-151020013428992^FS^A2,N,12,12^FO20,295^FDAdult (2 @ $39.00) $78.00^FS^A2,N,12,12^FO20,370^FDTOTAL $78.00^FS^A2,N,12,12^FO19,370^FDTOTAL $78.00^FS^A2,N,12,12^FO20,371^FDTOTAL $78.00^FS^A2,N,12,12^FO20,420^FDCASH $100.00^FS^A2,N,12,12^FO19,420^FDCASH $100.00^FS^A2,N,12,12^FO20,421^FDCASH $100.00^FS^A2,N,12,12^FO20,445^FD Transaction ID: e50eab381752702d2bbe^FS^A2,N,12,12^FO20,495^FDCHANGE: $22.00^FS^A2,N,12,12^FO19,495^FDCHANGE: $22.00^FS^A2,N,12,12^FO20,496^FDCHANGE: $22.00^FS^A2,N,12,12^FO20,545^FD All sales are final. Non-transferable.^FS^A2,N,12,12^FO20,570^FD No refunds. No exchanges.^FS^A2,N,12,12^FO20,595^FD THANK YOU!^FS^XZ 2015-10-19 20:41:45.850 PrintApp[3160:223372] ERROR: (null) 2015-10-19 20:41:55.771 PrintApp[3160:222559] Unable to get scanner info! 2015-10-19 20:41:55.788 PrintApp[3160:222559] Zebra mobile printer connected! 2015-10-19 20:42:02.563 PrintApp[3160:222559] Printing refund receipt... 2015-10-19 20:42:02.756 PrintApp[3160:223278] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:02.756 PrintApp[3160:223278] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:02.757 PrintApp[3160:223278] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:02.758 PrintApp[3160:222559] /SourceCache/IAPFramework/iapd-1506.20.30/IAP/IPC_Client/IAPApp.mm:IAPAppCreateSessionForAccessory-621 received an XPC_ERROR_CONNECTION_INVALID error. 2015-10-19 20:42:02.759 PrintApp[3160:222559] ERROR - opening session failed 2015-10-19 20:42:02.759 PrintApp[3160:222559] ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-288.20.7/EASession.m:-[EASession dealloc] - 141 unable to close session for _accessory=0x14f0ff30 and sessionID=65536 2015-10-19 20:42:02.764 PrintApp[3160:222559] creating session failed 2015-10-19 20:42:02.818 PrintApp[3160:222559] Unable to get scanner info! 2015-10-19 20:42:02.822 PrintApp[3160:222559] Unable to get printer info! 2015-10-19 20:42:05.771 PrintApp[3160:222559] Unable to get scanner info! 2015-10-19 20:42:05.776 PrintApp[3160:222559] Unable to get printer info! 2015-10-19 20:42:07.385 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.386 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.387 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.877 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:07.878 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:07.879 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has disconnected 2015-10-19 20:42:07.881 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.882 PrintApp[3160:222559] Setting zebraSerialNumber to [SERIAL_NUMBER_REDACTED] 2015-10-19 20:42:07.883 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.884 PrintApp[3160:222559] Setting zebraSerialNumber to [SERIAL_NUMBER_REDACTED] 2015-10-19 20:42:07.884 PrintApp[3160:222559] [VP]: Accessory [SERIAL_NUMBER_REDACTED] has connected 2015-10-19 20:42:07.885 PrintApp[3160:222559] Setting zebraSerialNumber to [SERIAL_NUMBER_REDACTED] 2015-10-19 20:42:15.769 PrintApp[3160:222559] Unable to get scanner info! 2015-10-19 20:42:15.791 PrintApp[3160:222559] Zebra mobile printer connected!
Often, the physical printer's LCD indicates that it has activity and is receiving data but doesn't print anything out.
What am I missing or doing wrong here?
iOS Print reliability |
1 Replies
Hi Jeffrey,
When using the newest version of the Link-OS™ Multiplatform SDK for iOS, a few developers have reported being unable to print images and/or text and receiving an “Unable to determine printer language” message. It sounds like you may be experiencing this, try changing the timeout on the MFi Bluetooth connection method setTimeToWaitAfterWriteInMilliseconds, from 10ms to a larger value like 30ms or higher to resolve the issue.
Here is an example of how to make this change:
// Establish the connection.
connection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialIP ];
// Change the the Time to wait after write from the default of 10ms to 30ms
[((MfiBtPrinterConnection*)connection) setTimeToWaitAfterWriteInMilliseconds:30];
Try that and let me know if that resolved the issue. Also, I saw you had another post regarding images, is that in connection with this post?
Thank you,
Beverly