devartis / passbook

Python library to create Apple Passbook (.pkpass) files
http://www.devartis.com/
MIT License
272 stars 108 forks source link

Generated Passbook can be opened by safari #53

Open rgranadosd opened 3 years ago

rgranadosd commented 3 years ago

Hello, I used this to do a pkpass test, but although all seems to be ok (as you can see in the attached screenshot)[

Captura de pantalla 2020-12-24 a las 8 53 23

](URL) passbook viewer and safari say that they can't open the file. I was looking for all around, with no success could anyone help me?

Here there is my sample file http://handbolsantquirze.cat/passbook/rafa.pkpass, please download using chrome but not safari because it's not downloading on safari

Thanks to all! and Merry Xmas

mbaechtold commented 3 years ago

I see the following log messages in the Console.app when I try to open your sample file:

error   15:22:11.139198+0100    Pass Viewer Invalid data error reading pass pass.com.handbolsantquirze.cat/1234567. No entry in manifest for file mipkpass.pkpass

default 15:22:11.140677+0100    Pass Viewer ERROR: Error Domain=PKPassKitErrorDomain Code=1 "The pass cannot be read because it isn’t valid." UserInfo={NSLocalizedDescription=The pass cannot be read because it isn’t valid., NSUnderlyingError=0x6000034cab50 {Error Domain=PKPassKitErrorDomain Code=1 "No entry in manifest for file mipkpass.pkpass" UserInfo={NSLocalizedDescription=No entry in manifest for file mipkpass.pkpass}}}

I'm wondering how the file mipkpass.pkpass did end up in your sample file. Was your sample file generated by this library?

rgranadosd commented 3 years ago

Many many thanks !

Yes ... I don't understand anything ... how can I see this log ?

Here I put the original code

from passbook.models import Pass, Barcode, StoreCard

cardInfo = StoreCard() cardInfo.addPrimaryField('name', 'John Doe', 'Name')

organizationName = 'Sww.L.' passTypeIdentifier = 'pass.com.handbolsantquirze.cat' teamIdentifier = 'WTE2LIEZ9C'

passfile = Pass(cardInfo, \ passTypeIdentifier=passTypeIdentifier, \ organizationName=organizationName, \ teamIdentifier=teamIdentifier)

passfile.serialNumber = '1234567' passfile.barcode = Barcode(message = 'Barcode message') passfile.description = 'A Sample Pass'

Including the icon and logo is necessary for the passbook to be valid.

passfile.addFile('./images/icon.png', open('icon.png', 'rb')) passfile.addFile('./images/logo.png', open('logo.png', 'rb')) passfile.addFile('./images/icon@2x.png', open('icon@2x.png','rb'))

Create and output the Passbook file (.pkpass)

password = '123456' passfile.create('certificate.pem', 'private.key', 'wwdr2030.pem', password , 'test.pkpass')

rgranadosd commented 3 years ago

already created another pkpass from the scratch http://handbolsantquirze.cat/passbook/test.pkpass with same result

isc-JianjieYu commented 3 years ago

Many many thanks !

Yes ... I don't understand anything ... how can I see this log ?

Here I put the original code

from passbook.models import Pass, Barcode, StoreCard

cardInfo = StoreCard() cardInfo.addPrimaryField('name', 'John Doe', 'Name')

organizationName = 'Sww.L.' passTypeIdentifier = 'pass.com.handbolsantquirze.cat' teamIdentifier = 'WTE2LIEZ9C'

passfile = Pass(cardInfo, passTypeIdentifier=passTypeIdentifier, organizationName=organizationName, teamIdentifier=teamIdentifier)

passfile.serialNumber = '1234567' passfile.barcode = Barcode(message = 'Barcode message') passfile.description = 'A Sample Pass'

Including the icon and logo is necessary for the passbook to be valid.

passfile.addFile('./images/icon.png', open('icon.png', 'rb')) passfile.addFile('./images/logo.png', open('logo.png', 'rb')) passfile.addFile('./images/icon@2x.png', open('icon@2x.png','rb'))

Create and output the Passbook file (.pkpass)

password = '123456' passfile.create('certificate.pem', 'private.key', 'wwdr2030.pem', password , 'test.pkpass')

Did you just put original code in test.passbook.py?