Joh*_*oan 1 objective-c passbook
我已经对证书进行了三次检查,看来我的问题可能在于 php-passbook 库输出的格式。
\n\n系留时通过控制台发出错误消息:
\n\nDec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: Invalid data error reading pass PASS-TYPE-IDENTIFIER/6731247236. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.\nDec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: PassBook Pass download failed: The pass cannot be read because it isn\xe2\x80\x99t valid.\nRun Code Online (Sandbox Code Playgroud)\n\n执行:
\n\n // Create an event ticket\n $pass = new EventTicket($event[\'Order\'][\'transaction_id\'], $event[\'Event\'][\'EventDetail\'][\'visible_name\']);\n $pass->setBackgroundColor(\'rgb(60, 65, 76)\');\n $pass->setLogoText(\'LOGO\');\n\n // Create pass structure\n $structure = new Structure();\n\n // Add primary field\n $primary = new Field(\'event\', $event[\'Event\'][\'EventDetail\'][\'visible_name\']);\n $primary->setLabel(\'Event\');\n $structure->addPrimaryField($primary);\n\n // Add secondary field\n $secondary = new Field(\'location\', \'LOCATION\');\n $secondary->setLabel(\'Location\');\n $structure->addSecondaryField($secondary);\n\n // Add auxiliary field\n $auxiliary = new Field(\'datetime\', \'2015-01-27 @10:25\');\n $auxiliary->setLabel(\'Date & Time\');\n $structure->addAuxiliaryField($auxiliary);\n\n\n\n // Add icon image\n $icon = new Image(APP . \'webroot\' . DS . \'/img/logo_growtix_admin_lg.png\', \'icon\');\n $pass->addImage($icon);\n\n // Set pass structure\n $pass->setStructure($structure);\n\n // Add barcode\n $barcode = new Barcode(Barcode::TYPE_QR, $key);\n $pass->setBarcode($barcode);\n\n // Create pass factory instance\n $factory = new PassFactory(\'PASS-TYPE-IDENTIFIER\', \'TEAM-IDENTIFIER\', \'ORGANIZATION-NAME\', APP . \'Vendor\' . DS . \'Passbook/certs/PASS.p12\', \'\', APP . \'Vendor\' . DS . \'Passbook/certs/AppleWWDRCA.pem\');\n $factory->setOutputPath(APP . \'webroot/passbook_passes\' . DS);\n $factory->package($pass);\n\n $this->redirect(\'/passbook_passes/\'.$event[\'Order\'][\'transaction_id\'].\'.pkpass\');\nRun Code Online (Sandbox Code Playgroud)\n\n以及生成的 JSON:
\n\n {\n"eventTicket": {\n "primaryFields": [\n {\n "key": "event",\n "value": "Event Name",\n "label": "Event"\n }\n ],\n "secondaryFields": [\n {\n "key": "location",\n "value": "The Salt Palace",\n "label": "Location"\n }\n ],\n "auxiliaryFields": [\n {\n "key": "datetime",\n "value": "2015-12-08T13:00-08:00",\n "label": "Date & Time"\n }\n ]\n},\n"serialNumber": "6731247236_5069_1913",\n"description": "Test",\n"formatVersion": 1,\n"barcode": {\n "format": "PKBarcodeFormatQR",\n "message": "test",\n "messageEncoding": "iso-8859-1"\n},\n"backgroundColor": "rgb(60, 65, 76)",\n"logoText": "GrowTix",\n"passTypeIdentifier": "PASS-TYPE-IDENTIFIER",\n"teamIdentifier": "TEAM-IDENTIFIER",\n"organizationName": "ORGANIZATION-NAME"\n}\nRun Code Online (Sandbox Code Playgroud)\n
问题是由于passTypeIdentifier和teamIdentifier键造成的。
日志中的这一行显示您正在使用“PASS-TYPE-IDENTIFIER”作为passTypeIdentifier密钥。
Dec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: Invalid data error reading pass PASS-TYPE-IDENTIFIER/6731247236. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
Run Code Online (Sandbox Code Playgroud)
您应该使用证书通行证类型 ID,例如pass.com.passkit.admin作为您的通行证类型标识符。这需要与证书上显示的通行证类型 ID/用户 ID 相匹配。
您teamIdentifier需要与证书中的组织单位相匹配。例如U4LNY2SS5N。
如果您使用的是 Mac,则可以使用 Finder 中的快速预览(空格键)查看这些详细信息。

| 归档时间: |
|
| 查看次数: |
2965 次 |
| 最近记录: |