【发布时间】: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 好的,我明白了。感谢您的建议。
-
如果你没有成功,把通行证发给我,我看看记录结果。