#mahi_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1347516637267365980
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mahi_code, 2 days ago, 13 messages
when update a sdk got a above error
I'd imagine there are probably breaking changes between the 2.x.x version your code is built for and the new version. Can you share your code?
sure
func connectToReader(_ reader: Reader) {
// Check if the reader is already connected
if isReaderConnected {
print("Already connected to a reader")
return
}
self.removeImg()
let locationId = ConstantManager.appConstant.locationID
do {
let connectionConfig = try BluetoothConnectionConfigurationBuilder(locationId: locationId).build()
Terminal.shared.connectBluetoothReader(reader, delegate: self, connectionConfig: connectionConfig) { connectedReader, error in
if let connectedReader = connectedReader {
print("Successfully connected to reader: \(connectedReader)")
self.isReaderConnected = true
UserDefaults.standard.set(true, forKey: "isCardReaderConnected")
UserDefaults.standard.set(connectedReader.serialNumber, forKey: "connectedReaderSerialNumber")
UserDefaults.standard.synchronize() // Save reader serial number
if self.cardReaderBtnClick == "true"{
self.connectToCardReader()
}
else{
print("elseee1234")
}
} else if let error = error {
print("connectBluetoothReader failed: \(error)")
self.removeImg()
}
}
} catch {
print("Error creating BluetoothConnectionConfiguration: \(error)")
}
}
func terminal(_ terminal: Terminal, didUpdateDiscoveredReaders readers: [Reader]) {
if self.tapToPayBtnClick == "true" {
print("Discovered (readers.count) reader(s):")
for reader in readers {
print("Reader: (reader)")
ConstantManager.appConstant.locationID = self.locationID?.data?.dataID ?? ""
let locationId = ConstantManager.appConstant.locationID
do {
let connectionConfig = try LocalMobileConnectionConfigurationBuilder(locationId: locationId).build()
try Terminal.shared.connectLocalMobileReader(reader, delegate: self, connectionConfig: connectionConfig) { connectedReader, error in
if let connectedReader = connectedReader {
print("Successfully connected to reader: \(connectedReader)")
let txtFldAmt = (self.priceTextField.text ?? "").replacingOccurrences(of: ",", with: "").replacingOccurrences(of: "Total Amount", with: "").replacingOccurrences(of: "£", with: "")
let doubletxtFldAmt = Double(txtFldAmt ) ?? 0.0
let taxAmt = Double(self.vat_amt ) ?? 0.0
let sendAmt = doubletxtFldAmt + taxAmt
I'd probably recommend you write in to our team and we can take a deeper look at this issue
Hello @zenith willow, we have sent you a direct message, please check it at https://discord.com/channels/@me/1346430680120299585
- 🔗The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.