Unable to determine printer language

Hello -


We're in the process of whitelisting our iOS app, so I updated to the latest version of the Link OS API and we also updated the firmware on our QLn220.  Prior to that update and on Android we have no issues, but since the update, we're getting an 'Unable to determine printer language' error when using the ZebraPrinterFactory to get a printer object.  We don't get the error every time.  In fact I've not seen it on the first print, but within 2-5 label prints it occurs and once it does, I have to restart the app to clear the error condition and print again.


We're currently on API 1.4.957  and firmware V68.19.15Z.  On the iOS side of things, our test device is Version 9.3.4.  We're using bluetooth to connect and we're sending cpcl.


I've seen a few other questions with similar issues and as you can see in the code below, we've tried the proposed solutions (changing the timeout value and forcing 'device.languages' in a SET statement).  Do you have any other ideas to try?




Josh Vance


Here's our current code:



- (NSString *) sendCPCLToPrinter:(NSString *)CPCLData



    NSLog(@"in sendFormatToPrinter");




// Instantiate connection for CPCL TCP port at given address.


    NSString *serialNumber = @"";


    //Find the Zebra Bluetooth Accessory

    EAAccessoryManager *sam = [EAAccessoryManager sharedAccessoryManager];

    NSArray * connectedAccessories = [sam connectedAccessories];

    for (EAAccessory *accessory in connectedAccessories) {

        NSLog(@"BT Device");

        NSLog([accessory serialNumber]);

        if([accessory.protocolStrings indexOfObject:@"com.zebra.rawport"] != NSNotFound){

            serialNumber = accessory.serialNumber;


            //Note: This will find the first printer connected! If you have multiple Zebra printers connected, you should display a list to the user and have him select the one they wish to use




    // Instantiate connection to Zebra Bluetooth accessory

    id<ZebraPrinterConnection, NSObject> thePrinterConn = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialNumber];


    [((MfiBtPrinterConnection*)thePrinterConn) setTimeToWaitAfterWriteInMilliseconds:300];


    // Open the connection - physical connection is established here.

    BOOL success = [thePrinterConn open];


    if (success) {


        NSError *error = nil;

        id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:thePrinterConn error:&error];


        NSError *seterror = nil;

        [SGD SET:@"device.languages" withValue:@"zpl" andWithPrinterConnection:thePrinterConn error:&seterror];


        NSError *statuserror = nil;

        PrinterStatus *printerStatus = [printer getCurrentStatus:&statuserror];

        NSString* status = nil;


        if (printerStatus.isReadyToPrint) {



            // Send the data to printer as a byte array.

            NSError *writeerror = nil;


            [thePrinterConn write:[CPCLData dataUsingEncoding:NSUTF8StringEncoding] error:&writeerror];

            if (writeerror == nil) {

                NSLog(@"in print - no error");

                [thePrinterConn close];

                return @"SUCCESS";


            } else {

                NSLog(@"in print - error");

                NSLog([writeerror localizedDescription]);

                [thePrinterConn close];

                return [NSString stringWithFormat: @"PRINT ERROR: %@",[writeerror localizedDescription]];



        } else {


            NSLog(@"in print - not isReady");


            if (error != nil) {

                 //THIS IS WHERE THE ERROR IS CAUGHT....  error COMES FROM ZebraPrinterFactory above

                return [NSString stringWithFormat: @"PRINTER ERROR: %@",[error localizedDescription]];



            if (seterror != nil) {

                return [NSString stringWithFormat: @"PRINTER LANG ERROR: %@",[error localizedDescription]];



            if (statuserror != nil) {

                return [NSString stringWithFormat: @"PRINTER STATUS ERROR: %@",[error localizedDescription]];



            if (printerStatus.isPaused) {

                return @"PRINTER ERROR: The printer is paused.";

            } else if (printerStatus.isHeadOpen) {

                return @"PRINTER ERROR: The printer is open.";

            } else if (printerStatus.isPaperOut) {

                return @"PRINTER ERROR: The paper is out.";

            } else {

                return(@"PRINTER ERROR: Unknown printer error.");



            [thePrinterConn close];





  } else {


        NSLog(@"in print - connection error");

        [thePrinterConn close];


        return @"CONNECTION ERROR: No connected bluetooth printer found.";