【问题标题】:Update Passbook Error - The pass cannot be read because it isn't valid更新存折错误 - 无法读取通行证,因为它无效
【发布时间】:2016-10-06 10:38:44
【问题描述】:

this document 中的“获取最新版本的通行证”部分之后,我正在尝试向我的设备发送一个新的通行证 json 数据以更新我在 Apple Wallet 中的通行证。
新的 json 数据与我用于成功创建 pass 的 json 数据完全相同,除了 backgroundColor 从 #3e7cc8 更改为 #000000 (用于测试)但我一直收到“Invalid json data”错误。
这里是创建成功的json数据

{
   "description":"description",
   "formatVersion":1,
   "organizationName":"organizationName",
   "passTypeIdentifier":"passTypeIdentifier",
   "serialNumber":"serialNumber",
   "teamIdentifier":"teamIdentifier",
   "foregroundColor":"#ffffff",
   "backgroundColor":"#3e7cc8",
   "labelColor":"#ffffff",
   "barcode":{
      "message":"d568866a45dfc010ac680a9d06e5a48feb9216a2",
      "messageEncoding":"utf-8",
      "format":"PKBarcodeFormatQR"
   },
   "logoText":"logoText",
   "storeCard":{
      "headerFields":[

      ],
      "primaryFields":[

      ],
      "secondaryFields":[
         {
            "key":"name",
            "label":"",
            "value":"Nick"
         },
         {
            "key":"points",
            "label":"",
            "value":"0 Points"
         }
      ],
      "auxiliaryFields":[

      ],
      "backFields":[
         {
            "key":"email",
            "label":"Email",
            "value":"hoangtrung.uit@gmail.com"
         },
         {
            "key":"phone",
            "label":"Phone",
            "value":"+841689984964"
         }
      ],
      "locations":[

      ]
   },
   "authenticationToken":"authenticationToken",
   "webServiceURL":"https://mydomain/passbook"
}

以及无效的更新json数据

{
   "description":"description",
   "formatVersion":1,
   "organizationName":"organizationName",
   "passTypeIdentifier":"passTypeIdentifier",
   "serialNumber":"serialNumber",
   "teamIdentifier":"teamIdentifier",
   "foregroundColor":"#ffffff",
   "backgroundColor":"#000000",
   "labelColor":"#ffffff",
   "barcode":{
      "message":"d568866a45dfc010ac680a9d06e5a48feb9216a2",
      "messageEncoding":"utf-8",
      "format":"PKBarcodeFormatQR"
   },
   "logoText":"logoText",
   "storeCard":{
      "headerFields":[

      ],
      "primaryFields":[

      ],
      "secondaryFields":[
         {
            "key":"name",
            "label":"",
            "value":"Nick"
         },
         {
            "key":"points",
            "label":"",
            "value":"0 Points"
         }
      ],
      "auxiliaryFields":[

      ],
      "backFields":[
         {
            "key":"email",
            "label":"Email",
            "value":"hoangtrung.uit@gmail.com"
         },
         {
            "key":"phone",
            "label":"Phone",
            "value":"+841689984964"
         }
      ],
      "locations":[

      ]
   },
   "authenticationToken":"authenticationToken",
   "webServiceURL":"https://mydomain/passbook"
}

我更新 json 数据有什么问题?请帮忙。

【问题讨论】:

  • 如果您尝试在 iOS 设备上打开通行证,日志记录(例如来自 XCode)通常会告诉您确切的问题。
  • @tomasmcguinness 通行证创建成功。当我尝试在this document中的“获取最新版本的通行证”之后发送更新 json 数据时遇到了问题@
  • iOS 仍会输出日志,指示更新失败的原因。当您发送推送通知时,iOS 应该完成轮询您的 API 并报告它在做什么的过程。
  • @tomasmcguinness 好的,我明白了。感谢您的建议。
  • 如果你没有成功,把通行证发给我,我看看记录结果。

标签: php ios passbook wallet


【解决方案1】:

如果您确定唯一改变的是背景颜色,则表明您的更新包中存在清单/签名问题或图标图像遗漏。可能值得解压缩更新的捆绑包并仔细检查它是否包含您认为它应该包含的内容。

#000000 有可能导致边缘情况(因为它等于零),但可以通过快速测试不同的测试值(如 #ff0000)来排除这种情况。

正如 Thomas 在 cmets 中所说,Xcode 中的设备日志应该会告诉您失败的确切原因。

【讨论】:

  • 我想知道,我们需要返回一个传递包还是只传递 json 数据?
  • 您需要返回一个新的、完整的、签名的通行证包。
【解决方案2】:

我不完全确定,但documentation 声明:

通道的背景颜色,指定为 CSS 样式的 RGB 三元组。例如 rgb(23, 187, 82)

您可以尝试按照文档给出的格式进行操作。

【讨论】:

  • 但是使用“backgroundColor”:“#3e7cc8”成功创建。 Anw,我将尝试将其更改为 CSS 样式的 RGB 三元组。谢谢。
猜你喜欢
  • 2017-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-30
  • 2017-07-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多