passkit-generator: Pass localization not working after fields push

Hi, I am setting the pass fields dynamically from code and then trying to localize the labels. I do not have lproj directory created as the media is still the same. My pass.json has passtype as generic : {}

I am setting values as

examplePass.primaryFields.push({
        "key" : "coupID",
        "label" : "CoupId_localized",
        "value" : "testid"
      });

Then localize as follows for french

examplePass.localize("fr", {
      "CoupId_localized": "Copon num_FR"
    });

examplePass.localize("en", {
      "CoupId_localized": "Copon num"
    });

The file gets dowloaded but its corrupted.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (14 by maintainers)

Most upvoted comments

Apple Wallet pass is pure macOS/iOS files, so, they know nothing about Windows. Path separator in Pass must always be ‘/’

Okay, no problem. I understand that passes may contain confidential infos but I request passes only for debugging purposes and delete them once the issue is closed.

I took one of the examples (barcode.js), and replaced the code from Line 31 to Line 72 with the code you passed me (primary fields and localization) and changed examplePass to Pass.

I also edited examples model examplePass to not have generic: {} as you told me.

Yeah, the download usually happen correctly even if the mime-type is wrong. A test you can try to do is to open up in a Mac or PC and rename it to .zip. If it opens correctly, the pass is well composed but might have other internal problems (some violated rule for example).

Also, if you have a Mac (thing that I don’t have right now), you can connect your iPhone via USB and open Console.app (/Applications/Utility/Console.app). You’ll be able to see iPhone logs, also the ones when you try to open a non-valid Pass. You can filter your log search for “Passkit”.

I don’t see anything wrong with your pass.json

I’ve edited your comment to look better at the code. 😉