经过测试我经历了以下(使用运行 iOS 6.1 beta 4 的 iPhone 5)
总之有两个问题;
- 您的网络服务正在发送一个无效的响应
https://ap.loc.sh/passbook/?couponId=486/v1/devices/5bca731a5779527c406213e9a847de97/registrations/pass.socialPoint.passbook/486
(这应该返回一个序列号数组,但只返回 1111)
- 通过您的 Web 服务发送的通行证包含无效数据。
以下是诊断您的问题的步骤,我还包括了设备控制台日志的摘录。
- pkpass 捆绑包成功添加到 Passbook
- 通行证成功注册到您的网络服务
Jan 15 14:03:03 passd[4219] <Warning>: Generating POST request with URL <https://ap.loc.sh/passbook/?couponId=486/v1/devices/5bca731a5779527c406213e9a847de97/registrations/pass.socialPoint.passbook/486>
Jan 15 14:03:03 passd[4219] <Warning>: Request contains header field <Authorization: ApplePass vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc>
Jan 15 14:03:03 passd[4219] <Warning>: Request contains body dictionary {
pushToken = XXXXXXX94500332b789a3ddb61800586d5c9aad1cb035c9f2725761d419950b2;
}
Jan 15 14:03:06 passd[4219] <Warning>: Register task (for device 5bca731a5779527c406213e9a847de97, pass type pass.socialPoint.passbook, serial number 486; with web service url https://ap.loc.sh/passbook/?couponId=486) got response with code 200
- 然后,设备会尝试检索同一证书 (pass.socialPoint.passbook) 的所有通行证的序列号 - 这是注册的标准部分,以防通行证数据过时并需要刷新。
Jan 15 14:03:06 passd[4219] <Warning>: Generating GET request with URL <https://ap.loc.sh/passbook/?couponId=486/v1/devices/5bca731a5779527c406213e9a847de97/registrations/pass.socialPoint.passbook>
Jan 15 14:03:11 passd[4219] <Warning>: Get serial #s task (for device 5bca731a5779527c406213e9a847de97, pass type pass.socialPoint.passbook, last updated (null); with web service url https://ap.loc.sh/passbook/?couponId=486) got response with code 200
Jan 15 14:03:11 passd[4219] <Warning>: Get serial #s task (for device 5bca731a5779527c406213e9a847de97, pass type pass.socialPoint.passbook, last updated (null); with web service url https://ap.loc.sh/passbook/?couponId=486) encountered error: Server response was malformed (The operation couldn’t be completed. (Cocoa error 3840.))
Jan 15 14:03:11 passd[4219] <Warning>: Generating POST request with URL <https:/ap.loc.sh/passbook/?couponId=486/v1/log> Jan 15 14:03:11 Anatta passd[4219] <Warning>: Request contains body dictionary {
logs = (
"[2013-01-15 14:03:11 +0800] Get serial #s task (for device 5bca731a5779527c406213e9a847de97, pass type pass.socialPoint.passbook, last updated (null); with web service url https://ap.loc.sh/passbook/?couponId=486) encountered error: Server response was malformed (The operation couldn\U2019t be completed. (Cocoa error 3840.))"
); }
Jan 15 14:03:11 passd[4219] <Warning>: Get serial #s task (for device 5bca731a5779527c406213e9a847de97, pass type pass.socialPoint.passbook, last updated (null); with web service url https://ap.loc.sh/passbook/?couponId=486) will retry after 10 seconds
设备收到无效响应,但会继续重试。
手动刷新通行证,显示另一个错误:
Jan 15 14:11:05 passd[4238] <Warning>: Get pass task (pass type pass.socialPoint.passbook, serial number 486, if-modified-since (null); with web service url https://ap.loc.sh/passbook/?couponId=486) got response with code 200
Jan 15 14:11:05 passd[4238] <Warning>: Invalid data error reading pass . Could not read json from URL file://localhost/var/mobile/Library/Caches/com.apple.passd/com.apple.Shoebox/EE7EC165-DFC8-4B74-8444-37FB4C84B542.pkpass/pass.json: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 369.) UserInfo=0x361810 {NSDebugDescription=Invalid value around character 369.}
Jan 15 14:11:05 passd[4238] <Warning>: Get pass task (pass type pass.socialPoint.passbook, serial number 486, if-modified-since (null); with web service url https://ap.loc.sh/passbook/?couponId=486) encountered error: Received invalid pass data (The pass cannot be read because it isn't valid.)
Jan 15 14:11:05 passd[4238] <Warning>: Generating POST request with URL <https://ap.loc.sh/passbook/?couponId=486/v1/log>
Jan 15 14:11:05 Anatta passd[4238] <Warning>: Request contains body dictionary {
logs = (
"[2013-01-15 14:11:05 +0800] Get pass task (pass type pass.socialPoint.passbook, serial number 486, if-modified-since (null); with web service url https://ap.loc.sh/passbook/?couponId=486) encountered error: Received invalid pass data (The pass cannot be read because it isn't valid.)"
);
}
您的网络服务发送的第二遍的 pass.json 似乎不正确。
检查 pass.json 后,locations 键后似乎有错误:
{
"formatVersion" : 1,
"passTypeIdentifier" : "pass.socialPoint.passbook",
"serialNumber" : "",
"teamIdentifier" : "9TS732CS23",
"authenticationToken" : "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc",
"webServiceURL" : "https://ap.loc.sh/passbook/?couponId=",
"associatedStoreIdentifiers":[564576004],
"relevantDate" : "1970-01-01T08:00:00+08:00",
"locations" : , // Syntax error
"organizationName" : "portaura",
"logoText" : "",
"description" : "Here is description",
"backgroundColor" : "rgb(146, 108, 63)",
"coupon" : { etc...