Trouble printing to ZQ520 on IOS but not Android

Hi there:

I am working on a cross platfrom Zebra Printer application on Android and IOS. Using the bit of code below
I can successfully print on Android - however when trying to print on IOS I am able to Connect - but get an immediate
"Error writing to connection". In addition if I get the printer status I get this error:
"Error getting status: Malformed status response - unable to determine printer status". In addition this command:
IZebraPrinter printer = ZebraPrinterFactory.Current.GetInstance(printerLanguage, connection);
will timeout on IOS as well - while working on Android.

The Info.plist seems to be in order - and matches our current IOS only application which is working fine. I have the privacy setting and specify the port.

Sounds like a config issue - but not sure what else to change. Code is attached below:

//Where ChosenPrinter implements IDiscoveredPrinter
//Error occurs attempting to invoke Connection.Write.
//My connection properties just prior to writing are attached in the image below.

connection = ChoosenPrinter.Connection;
if (!connection.IsConnected) connection.Open();
PrinterLanguage printerLanguage = PrinterLanguage.ZPL;
IZebraPrinter printer = ZebraPrinterFactory.Current.GetInstance(printerLanguage, connection);
/*if ((!CheckPrinterLanguage(connection)) || (!PreCheckPrinterStatus(printer)))
{

return;
}*/
printer.Connection = connection;
if (Device.RuntimePlatform == Device.iOS)
{
printer.Connection = connection;
//string printerSettings = m_session.AppSpec.GetValue<string>("ZebraPrinterVarSettings", "");
string printerSettings = "! U1 setvar \"device.languages\" \"zpl\"+! U1 setvar \"media.type\" \"journal\"";
string[] vars = printerSettings.Split('+);
if (vars != null && vars.Length > 0)
{
foreach (string var in vars)
{
connection.Write(Encoding.UTF8.GetBytes(var + "\r\n"));
}
//connection.Write(Encoding.UTF8.GetBytes("! U1 setvar \"device.languages\" \"zpl\"\r\n"));
//connection.Write(Encoding.UTF8.GetBytes("! U1 setvar \"media.type\" \"journal\"\r\n"));
}
}

Steven Si
For iOS, we need to add com

For iOS, we need to add com.zebra.rawport to the "supported external accessory protocols" in the info.plist in order to allow the app to connect to Zebra printer over Bluetooth.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments