I’m making an attempt to make use of a vCard because the content material of a QR or barcode in Apple Pockets. I have been in a position to encode the content material, however the QR code just isn’t readable – and I consider thats as a result of I’ve not been in a position to prep/format the info forward of time correctly.
Whereas I’m utilizing PHP, this is not a language-specific query.
Here’s a pattern vCard that I have been utilizing:
BEGIN:VCARD
VERSION:3.0
REV:2023-11-08T00:00:00Z
N:Murphy;Jill;;;
ORG:Firm
TITLE:Developer
EMAIL;INTERNET;WORK:[email protected]
URL:https://instance.com
END:VCARD
In Apple’s Pockets format, the barcode knowledge is laid out in JSON format:
"barcode": {
"format": "PKBarcodeFormatQR",
"message": "VCARD_DATA_HERE",
"messageEncoding": "iso-8859-1"
},
I’ve tried the next in numerous mixtures:
- Passing within the vCard textual content immediately
- Concatenate the vCard knowledge into one line with “
n
” delimiters - Utilizing
urlencode
(PHP) - All the above with Apple’s numerous supported barcode codecs
These codecs are:
PKBarcodeFormatQR, PKBarcodeFormatPDF417, PKBarcodeFormatAztec, and PKBarcodeFormatCode128
I do know I can host a vCard and simply have the barcode be of a URL however I’m deliberately going for a self-contained model.
Can anybody present steerage on how one can format the vCard textual content earlier than I put it into go.json
so it permits for a readable barcode?