0

I have successfully implemented the Link OS iOS SDK into my Xcode project.

I created a bridging header for the .h files, and I am able to print successfully to our Zebra Printers

I am having an issue where extra tags are being printed. Explained:

  1. Connection is open with IP and port
  2. ZPL data is sent to printer, and tag prints successfully 
  3. Connection is closed

About 20% of the time, when the app is opened again to the main page, the zebra printer will open the tcp connection and print the same tag again. I am stumped and have no idea what is causing this. Any help is appreciated. I added a time stamp to print on the labels, when the extra tag is printed it's using the time stamp form the original tag printed.

I have already tried the following but the issue is still happening:

  1. Set the TcpPrinterConnection object to nil after closing
  2. Wrapped the function in an autoreleasepool

Code:

autoreleasepool {
    var connection = TcpPrinterConnection.init(address: printerIP, andWithPort: 6101)
    
    if connection!.open() == true {
        do {
            try tool!.sendCommand(writeDate)
            connection!.close()
        } catch {
            connection!.close()
            print(error.localizedDescription)
        }
    }
}
Willm132
  • 17
  • 9
  • The connection does not look like remains open. Instead, the connection was opened again when your app reopens. You should be able to trace how the connection is opened again unintentionally in the debugger of Xcode. – ssizebra Jul 13 '23 at 14:10
  • @ssizebra The function is being called when the app opens to the main view controller, not when the view controller that calls the function is open. I also have the func called when a button is pressed and the button is not being pressed and the function is being called. – Willm132 Jul 28 '23 at 14:10

0 Answers0