1

我已经实施了存折和更新。我eo/passbook-bundle在打包存折时使用了and has created below JSON没有错误,但是当在更新过程中,服务器调用webServiceURL/version/passes/passTypeIdentifier/serialNumberapi,设备下载完全相同的JSON(但没有打包,只是这个json),它失败。

我在更新 Apple Wallet Pass 时收到了关于 Received invalid pass data的评论中读到它可能与正确的标头有关,但在响应中返回的任何特定标头的文档中没有任何描述(请参阅https:// /developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html )

我正在使用 symfony 返回带有编码 json 的响应,如下所示:

$json = PassFactory::serialize($storecard);
return new Response($json, 200, ['Content-Type' => 'application/json']);

我也尝试过没有 Content-Type 标头。

在日志中我可以看到:Get pass task (pass type pass.com.spinpos.latest.customercard, serial number 5, if-modified-since (null); with web service url https://my.domain.com/api/loy/wallet/) encountered error: Received invalid pass data (The pass cannot be read because it isn’t valid.)

JSON 响应是这样的:

{
   "storeCard":{
      "headerFields":[
         {
            "key":"prepaid",
            "value":"0,00",
            "label":"PREPAID"
         }
      ],
      "secondaryFields":[
         {
            "key":"username",
            "value":"Some Name",
            "label":"GEBRUIKERSNAAM"
         },
         {
            "key":"lastvisit",
            "value":"niet bekend",
            "label":"LAATSTE BEZOEK"
         }
      ],
      "auxiliaryFields":[
         {
            "key":"qrcode",
            "value":"2690310109104",
            "label":"QR CODE"
         },
         {
            "key":"points",
            "value":20,
            "label":"LOYALTY PUNTEN"
         }
      ],
      "backFields":[
         {
            "key":"website",
            "value":"http://www.somesite.com",
            "label":"WEBSITE"
         },
         {
            "key":"phone_number",
            "value":"05311223344",
            "label":"TELEFOONNUMMER"
         },
         {
            "key":"terms_of_service",
            "value":"Dit zijn test algemene voorwaarden!",
            "label":"ALGEMENE VOORWAARDEN"
         }
      ]
   },
   "serialNumber":"5",
   "description":"Your Customer card",
   "formatVersion":1,
   "locations":[
      {
         "latitude":51.62,
         "longitude":5.55,
         "relevantText":"Some Loc 2"
      },
      {
         "latitude":51.7737967,
         "longitude":5.5513203,
         "relevantText":"Some loc 1"
      },
      {
         "latitude":52.2648569,
         "longitude":6.8018085,
         "relevantText":"Testdfdr"
      }
   ],
   "barcode":{
      "format":"PKBarcodeFormatQR",
      "message":"2690310109104",
      "messageEncoding":"iso-8859-1"
   },
   "barcodes":[
      {
         "format":"PKBarcodeFormatQR",
         "message":"2690310109104",
         "messageEncoding":"iso-8859-1"
      }
   ],
   "backgroundColor":"rgb(255,108,108)",
   "foregroundColor":"rgb(46,14,170)",
   "labelColor":"rgb(110,255,75)",
   "authenticationToken":"048cfd30e4baf1c3250f0c8c7500f998aee2da49",
   "webServiceURL":"https://my.domain.com/api/loy/wallet/"
}

有人知道 JSON 或标头有什么问题吗?

4

1 回答 1

3

您需要发送带有标头的全新签名 .pkpass 包application/vnd.apple.pkpass

于 2017-06-22T15:40:06.710 回答