we are using the STMicroelectronics/STNFCSensor tag, the tag configuration is Block Size: 4 Memory size in blocks: 2048 memory size in bytes: 8192 tag type: iso15693
Below i added my code
func readSingleBlock(to tag: NFCTag, blockNumber: Int, completion: @escaping (Data) -> Void) {
bfprint("NFC_Tag enter extendedReadSingleBlock blockNumber: \(blockNumber)")
if case let .iso15693(tagIso15693) = tag {
tagIso15693.extendedReadSingleBlock(requestFlags: [.highDataRate], blockNumber: blockNumber) { result in
bfprint("NFC_Tag extendedReadSingleBlock \(result)")
switch result {
case .success(let data):
self.retryAttempt = 0
bfprint("NFC_Tag Success tag response:", "\(data), ")
completion(data)
case .failure(let error):
if self.retryAttempt > 5 {
bfprint("NFC_Tag failure: \(error) \(error.localizedDescription) ")
self.session?.invalidate(errorMessage: error.localizedDescription)
} else {
self.retryAttempt += 1
bfprint("NFC_Tag failure retryAttempt: \(self.retryAttempt) ")
self.retryConnection()
}
}
}
}
}
func retryConnection() {
guard let session,
let tag = self.tag else { return }
session.connect(to: tag) { [weak self] (error) in
if let error = error {
print("Retry connection error: \(error.localizedDescription)")
self?.session?.invalidate(errorMessage: "Retry connection error: \(error.localizedDescription)")
return
}
self?.readNfcTag(tag: tag)
}
}
extendedReadSingleBlock function giving error "NFCError Code=100 “Tag connection lost”