alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js
MIT License
829 stars 104 forks source link

Barcode, QRCode not generating #151

Closed alecsorenpedersen closed 1 year ago

alecsorenpedersen commented 1 year ago

Running Node Version

Mac V12.6

Node v20.2.0

Description

I have created a pass, everything works except the QR code & barcode this is my pass.json

{
    "barcode": {
        "format": "PKBarcodeFormatQR",
        "message": "...",
        "messageEncoding": "iso-8859-1"
    },
    "generic": {
        "primaryFields": [...],
        "secondaryFields": [...],
        "auxiliaryFields": [...],
        "backFields": [...]
    }
}

Tried so much, got to the point where even ChatGPT4 told me to ask you as it didn't know

alexandercerutti commented 1 year ago

Hey @alecsorenpedersen, thanks for using passkit-generator!

Sorry, but your post doesn't specify enough details about how you composed your pass, so if you could share your code, I might be helpful!

You are saying that your barcode is not showing? Where are you trying to opening your pass?

Let me know!

alexandercerutti commented 1 year ago

I think to understand what is happening. You know, pass.json property barcode is actually deprecated by Apple and, therefore, I do not support it anymore. When pass.json is loaded, barcode fails validation and gets excluded.

To confirm my suspect, you can rename your .pkpass file into a .zip file, extract it, and look inside pass.json if the barcode is there or not.

You should actually hardcode barcodes (here is the link to Apple Wallet Documentation, please note that it is an array) or use pass.setBarcodes() API to let it handle for you.

Let me know if this solves your issue!

alexandercerutti commented 1 year ago

Oh, some suggestions about your code:

1) You can use pass.mimeType instead of writing it on your own. 2) You can use pass.getAsStream() instead of converting it by yourself (I already do that 😄)

I hope you appreciate ;)

alecsorenpedersen commented 1 year ago

I got it working thank you so much

alexandercerutti commented 1 year ago

Hey there @alecsorenpedersen, I saw you attempted to delete part of this conversation.

It's okay for what concerns the code (even if it's almost the same everywhere). For what concerns the first message, revisions were still visible, so I proceeded into recovering one and delete the others. While recovering, I have hidden most of the information about your pass.json, which was useless to the issue thread. I preferred to recover at least the main content to give some context for whoever will read it in the future! I hope you don't mind!