Posts

Post not yet marked as solved
1 Replies
979 Views
Hi,I am trying to write NDEF-data to a nfc-tag. It works partially. I can write data to the tag. But the data is written with UTF-16 which makes it unreadable for my android app. How do I create a NFCNDEFPayload.wellKnownTypeTextPayload with utf-8 encoding.This is how I create and write the NDEF.//ndef creation let textPayload = NFCNDEFPayload.wellKnownTypeTextPayload(string: tmpMessage, locale: Locale(identifier: "En")) self.ndefMessage = NFCNDEFMessage(records: [(textPayload!)]) //write tag.writeNDEF(self.ndefMessage!) { (error: Error?) in print(error ?? "error") if error != nil { session.invalidate(errorMessage: "Update tag failed. Please try again.") } else { session.alertMessage = "Update success!" session.invalidate() } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
323 Views
I am using the new nfc write capabilities and are writing successful to tags. But my payload data becomes written in utf-16. I want it to be utf8. How do I accomplish that?This is how I create and write the NDEF:let textPayload = NFCNDEFPayload.wellKnownTypeTextPayload(string: tmp, locale: Locale(identifier: "En")) self.ndefMessage = NFCNDEFMessage(records: [(textPayload!)]) tag.writeNDEF(self.ndefMessage!) { (error: Error?) in print(error ?? "error") if error != nil { session.invalidate(errorMessage: "Update tag failed. Please try again.") } else { session.alertMessage = "Update success!" session.invalidate() } }
Posted Last updated
.