-[TcpPrinterConnection waitForStreamsToFinishOpening]
Crashed: com.apple.root.background-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000048
var printerConnection = TcpPrinterConnection()
printerConnection = TcpPrinterConnection.init(address: "192.168.0.74", andWithPort: 6101)
printerConnection.open() <--- crashing here sometimes
printerConnection.write(data, error: &error) <--- crashing here sometimes also
5 Replies
Are you using the UI thread to call the printerConnection.open() and printerConnection.write()? The Zebra printers are considered as slow accessories. Therefore, the API in the Link-OS SDK for iOS should be called by non-UI thread. Please use a background thread or spawn a new thread to call the APIs in the SDK.
I am using: DispatchQueue.global(qos: .userInteractive).async
Not sure what else could be wrong. But I suggest to test the Developer Demo project that comes with the release package of the Link-OS SDK for iOS. The Developer Demo has the sample code for a TCP connection that works as expected. It will give you a sense about how the API works in the Objective-C. Then go from there to debug your code further.
The issue is the code is in Object C. Swift came out in 2014, will Zebra every update their code?
I've just tested the Developer Demo project in Objective-C on my iOS 14 & 15 devices. The TCP connection.open() and connection.write() works as expected. Though the SDK for iOS has not been updated for sometime, we have not seen any issues. For Swift, we expect the users to use the bridge header. There is no plan to create a Swift specific SDK.