Is there a way to monitor and prevent the printer from locking up (LinkOS)?

I have an iOS app using the LinkOS SDK communicating via bluetooth with a ZQ520 printer. I'm using the following code to print labels:

-(NSError*)printReceiptAsOneJobUsingNSString:(id<NSObject,ZebraPrinter>)printer withString:(NSMutableString*)fullLabel {

    /*

     Sending large amounts of data in a single write command can overflow the NSStream buffers which are the underlying mechanism used by the SDK to communicate with the printers.

     This method shows one way to break up large strings into smaller chunks to send to the printer

     */

    NSError *error = nil;

   

    long blockSize = 1024;

    long totalSize = fullLabel.length;

    long bytesRemaining = totalSize;

   

    while (bytesRemaining > 0) {

        long bytesToSend = MIN(blockSize, bytesRemaining);

        NSRange range = NSMakeRange(0, bytesToSend);

       

        NSString *partialLabel = [fullLabel substringWithRange:range];

       

        [[printer getToolsUtil] sendCommand:partialLabel error:&error];

       

        bytesRemaining -= bytesToSend;

       

        [fullLabel deleteCharactersInRange:range];

       

    }

    return error;

}

Also, whenever the user connects to the printer, it stores a few images on the printer using the following code:

// Save image to printer

id<GraphicsUtil, NSObject> graphicsUtil = [self.printer getGraphicsUtil];

NSError *error = nil;

BOOL success = [graphicsUtil storeImage:pathOnPrinter withPathOnDevice:pathOnDevice withWidth:width andWithHeight:height error:&error];

It usually works fine, but I have received a bug report describing a locked-up printer. Shortly after printing a label, a user's ZQ520 printer became unresponsive, with a steady "envelope icon" on screen signifying that it is trying to receive data, but no data was being received because it was not blinking. He tried un-pairing and re-pairing the printer with the iPhone, and tried restarting the phone and the printer, but the printer still kept the steady "envelope icon" and wouldn't accept a new connection. Eventually, after re-pairing the printer's bluetooth connection to the phone multiple times, the "envelope icon" went away, and he was able to print again.

I haven't been able to reproduce this issue myself yet. Do you know how the LinkOS SDK could have put the printer in this unresponsive mode? And if so, what's the recommended way to monitor and avoid this situation using the LinkOS SDK?