【发布时间】:2018-11-15 13:44:41
【问题描述】:
我目前正在研究票证的钱包支持,并已成功为安卓钱包生成 .pkpass(存折/钱包)文件。
我正在使用 Tomas McGuinness 的 dotnes-passbook Nuget 创建 .pkpass 文件。
问题是我的 .pkpass 文件无法在 Apple 钱包上运行。 每次我尝试在 Mac 或 iPhone 上打开一个文件时,它都会说 safari 无法打开这个文件。我希望有人能指出我做错了什么。
这些是 .pkpass 包中的 .json 文件:
pass.json 文件:
{ "passTypeIdentifier": "pass.nl.lvpres",
"formatVersion": 1,
"serialNumber": "13843489004291",
"description": "Dit ticket heeft geen beschrijving.",
"organizationName": "LVPreserveringssystemen",
"teamIdentifier": "M644RRJBDM",
"sharingProhibited": false,
"logoText": "Kamagura",
"relevantDate": "2018-11-15T14:06:52+01:00",
"maxDistance": "1000",
"locations": [
{
"latitude": 51.9207297316102,
"longitude": 4.4561515896691,
"relevantText": "U bent dichtbij"
}
],
"foregroundColor": "rgb(238,238,238)",
"backgroundColor": "rgb(255,255,255)",
"labelColor": "rgb(170,170,170)",
"expirationDate": "2018-12-30T00:00:00",
"voided": false,
"eventTicket": {
"headerFields": [
{
"key": "date1",
"label": "DATUM",
"dateStyle": "PKDateStyleShort",
"timeStyle": "PKDateStyleShort",
"value": "2019-06-01T20:00Z"
}
],
"primaryFields": [
{
"key": "EventNaam",
"label": "EVENT",
"value": "Kamagura"
}
],
"secondaryFields": [
{
"key": "Locatie",
"label": "LOCATIE",
"value": "Theater Hanzehof"
},
{
"key": "Plaats",
"label": "PLAATS",
"value": "Zutphen"
},
{
"key": "Zaal",
"label": "ZAAL",
"value": "Theater Demo"
}
],
"auxiliaryFields": [
{
"key": "Rij",
"label": "RIJ",
"value": "5"
},
{
"key": "Stoel",
"label": "STOEL",
"value": "7"
},
{
"key": "Beschrijving",
"label": "Beschrijving van de activiteit:",
"value": "Dit ticket heeft geen beschrijving."
}
],
"backFields": [
{
"key": "keyb2",
"label": "Over ons",
"value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}
]
},
"barcode": {
"format": "PKBarcodeFormatQR",
"message": "13843489004291",
"messageEncoding": "iso-8859-1"
},
"authenticationToken": "30246720af7f660136fd833f3886370b9995ba25",
"webServiceURL": "https://secure.ticketunie.com/Wtickets/Tickets/"
}
还有 manifest.json 文件:
{
"pass.json": "c6b01b68b6a4fbada64c34cca61a7bfd181c5bd9",
"icon.png": "993bcb011b93232db712724260b62d390d822fc6",
"icon@2x.png": "993bcb011b93232db712724260b62d390d822fc6",
"logo.png": "2e293ee364e5573bee329202b0996eacfcdb21b4",
"logo@2x.png": "2e293ee364e5573bee329202b0996eacfcdb21b4",
"thumbnail.png": "903b2fe6bd4cca1ecba481fea74be04e4231a640",
"thumbnail@2x.png": "903b2fe6bd4cca1ecba481fea74be04e4231a640",
"strip.png": "2e293ee364e5573bee329202b0996eacfcdb21b4",
"strip@2x.png": "2e293ee364e5573bee329202b0996eacfcdb21b4"
}
【问题讨论】:
-
您将
MaxDistance作为字符串,您可能还需要在您的数据/时间值"value": "2019-06-01T20:00Z"中添加秒,在您的expirationDate2018-12-30T00:00:00中添加时区。如果上述方法不能解决问题,您可以发布通行证的链接吗?这可能是一个签名错误,但是当您尝试将通行证加载到 Mac 或 iPhone 时,如果不检查控制台就无法进行诊断。 -
你好。我是图书馆的创造者。如上一条评论所述,如果您能提供样本通行证,那就太好了。
-
@TomasMcGuinness 和 Passkit 感谢您的帮助,我已经编辑了日期,我可以在 mac 上查看通行证,但仍然无法将其添加到 IOS 钱包。它现在在控制台上给我以下错误:提供的 passTypeIdentifier 或 teamIdentifier 可能与您的证书不匹配,或者无法验证证书信任链。我使用您的 passvalidator 检查了通行证,PassTypeIdentifier 和 TeamIdentifier 是有效的,所以我猜它的证书信任链不正确。这是示例通行证:drive.google.com/open?id=1PoGJnDxF4UZ1-H-of3vt68URVBHVK0WQ
-
@TomasMcGuinness 我也尝试在 dotnet-passbook 库中使用实际的 DateTime 对象作为 DateField 和 expiredate,但库一直将这些转换为不正确的格式,我能做些什么吗?我是否必须使用标准字段作为 DateField 才能将其添加为字符串而不是 DateTime。而且到期日期我不知道该怎么办,因为我只能将其添加为 DateTime。提前致谢
-
我收到了一些关于信任链问题的报告,所以我正在调查它。您是如何创建通行证类型证书的 pfx 版本的?在 DateTime 对象方面,我已通过更改为 Offsets 在代码中修复了此问题,但尚未发布更新的 Nuget 包。