tschoffelen / php-pkpass

💳 PHP class for creating passes for Wallet on iOS.
https://includable.com
MIT License
908 stars 187 forks source link

Passbook not showing up in lock screen #67

Closed fedegiust closed 7 years ago

fedegiust commented 7 years ago

I'm creating an apple passbook for events, using your library.

It opens fine on my phone and everything but even though I'm using the relevanceDate as it says here (https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW53) to show up on the lock screen, it's not coming up.

I tried with todays date and tomorrows date but still is not coming up on the lock screen.

This is the pass.json

{
        "description": "Event Confirmation",
        "formatVersion": 1,
        "organizationName": "EventTest",
        "passTypeIdentifier": "pass.com.eventtest.confirmation",
        "serialNumber": "#########",
        "teamIdentifier": "######",
        "expirationDate": "2017-05-04T23:00:00Z",
        "relevantDate": "2017-04-28T07:00Z",
        "eventTicket": {
            "headerFields": [{
                "key": "eventHeader",
                "label": "TEST",
                "value": ""
            }],
            "secondaryFields": [{
                "key": "nameSecondaryFields",
                "label": "Name",
                "value": "Federico Giust"
            }],
            "auxiliaryFields": [{
                "key": "locAuxiliaryFields",
                "label": "Brixton Academy",
                "value": "Brixton, London, UK"
            }, {
                "key": "startdateAuxiliaryFields",
                "label": "Start Date",
                "value": "28-04-2017"
            }, {
                "key": "enddateAuxiliaryFields",
                "label": "End Date",
                "value": "05-05-2017"
            }],
            "backFields": [{
                "key": "eventBackFields",
                "label": "TEST",
                "value": "Test Project - Local"
            }, {
                "key": "locBackFields",
                "label": "Brixton Academy",
                "value": "Brixton, London, UK"
            }, {
                "key": "startdateBackFields",
                "label": "Start Date",
                "value": "28-04-2017"
            }, {
                "key": "enddateBackFields",
                "label": "End Date",
                "value": "05-05-2017"
            }, {
                "key": "eventDescription",
                "label": "Description",
                "value": "Project Description goes here"
            }, {
                "key": "eventURL",
                "label": "Website",
                "value": "https:\/\/www.eventtest.com"
            }, {
                "key": "eventT&C",
                "label": "Terms and Conditions",
                "value": "Terms & Conditions"
            }]
        },
        "barcode": {
            "altText": "4156452",
            "format": "PKBarcodeFormatQR",
            "message": "4156452",
            "messageEncoding": "iso-8859-1"
        },
        "backgroundColor": "rgb(255,255,255)",
        "foregroundColor": "rgb(000, 000, 000)",
        "logoText": "Test Project - Local"
    }

How far in advance a passbook is supposed to appear on the lock screen? Am I missing another field?

I already have location services enabled and wallet notifications enabled and it works for other passbooks.

Thanks

tschoffelen commented 7 years ago

I think your format for relevantDate is incorrect. Apple docs refer to requiring a W3C-formatted date, which apparently is something like this: 2017-04-28T23:43:16+00:00.

In PHP, that would be $date = date('Y-m-d\TH:i:sP');.

I just updated the simple example, the code there makes the pass show up on my homescreen. Give it a minute or two though, it doesn't always show up directly.

Let me know if that works for you!

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.