gpt4 book ai didi

PHP 生成的通行证未安装在 iPhone 上的钱包中

转载 作者:行者123 更新时间:2023-11-29 00:44:42 27 4
gpt4 key购买 nike

我正在使用这个 passgenerator 库生成一个 .pkpass,它应该安装在 iPhone 上的苹果钱包上。 .pkpass 文件已成功生成,但无法添加到 iPhone 上的“钱包”中,当我尝试从电子邮件附件中打开此文件时甚至没有显示任何错误。当我在 Mac 上使用“Pass Viewer”打开它时,它在条形码区域显示一些错误。这是截图;

coupon

我不知道我哪里做错了。我正在使用 laravel 5.1 并且我已经正确地需要这个包,并且作为文档要求设置环境变量来设置证书路径。

CERTIFICATE_PATH= './assets/certificates/PassCertificate.p12'
CERTIFICATE_PASS= "mypassword"
WWDR_CERTIFICATE='./assets/certificates/WWDRCA.pem'

这是我的 Controller 代码,我在其中以 json 格式设置其配置。

public function index(PassGenerator $pass)
{
$pass_identifier = 'testPkPass'; // This, if set, it would allow for retrieval later on of the created Pass
$pkpass = $pass->getPass($pass_identifier);
if (!$pkpass) {
$pkpass = $this->createWalletPass($pass_identifier);
}
$path = storage_path().'/app/passgenerator/'.$pass_identifier.'.pkpass';
return Response::download($path, $pass_identifier.'.pkpass', [
'Content-Transfer-Encoding' => 'binary',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename="myTestingPass.pkpass"',
'Content-length' => strlen($pkpass),
'Content-Type' => PassGenerator::getPassMimeType(),
'Pragma' => 'no-cache',
]);
}

private function createWalletPass($pass_identifier)
{

$pass = new PassGenerator($pass_identifier);

$pass_definition = [
"description" => "description",
"formatVersion" => 1,
"organizationName" => "Black Book",
"passTypeIdentifier"=> "pass.biz.myIdentifier.coupon",
"serialNumber" => "123456",
"teamIdentifier" => "xyz",
"foregroundColor" => "rgb(255, 255, 255)",
"backgroundColor" => "rgb(44, 49, 51)",
"barcode" => [
"message" => "encodedmessageonQR",
"format" => "PKBarcodeFormatQR",
"altText" => "altextfortheQR",
"messageEncoding"=> "utf-8",
],
"coupon" => [
"headerFields" => [
[
"key" => "header",
"label" => "Value",
"value" => "30%"
]
],
"secondaryFields" => [
[
"key" => "welcome",
"label" => "",
"value" => "Welcome valued customer!"
],
[
"key" => "date",
"label" => "EXPIRES",
"value" => "2016/06/29"
]
],
"backFields" => [
[
"key" => "terms",
"label" => "Terms & Conditions",
"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."
], [
"key" => "contact",
"label" => "Contact Us",
"value" => "[Contact-us] 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."
],
],
],
];

$pass->setPassDefinition($pass_definition);

// Add assets to the PKPass package
$pass->addAsset(base_path('public/assets/wallet/background.png'));
$pass->addAsset(base_path('public/assets/wallet/thumbnail.png'));
$pass->addAsset(base_path('public/assets/wallet/icon.png'));
$pass->addAsset(base_path('public/assets/wallet/logo.png'));

$pkpass = $pass->create();
return $pkpass;
}

任何帮助将不胜感激。如果我在配置或其他地方做错了什么,请告诉我。

最佳答案

您的签名有问题。

Aug  5 16:38:36 pfr MobileSafari(PassKitCore)[2017] <Notice>: Error evaluating trust: <private>
Aug 5 16:38:36 pfr MobileSafari(PassKitCore)[2017] <Notice>: Signature validation: *** FAILED ***
Aug 5 16:38:36 pfr MobileSafari(PassKitCore)[2017] <Fault>: Invalid data error reading pass <private>. <private>
Aug 5 16:38:36 pfr MobileSafari(PassKitCore)[2017] <Notice>: Invalid data error reading pass <private>. <private>
Aug 5 16:38:36 pfr MobileSafari[2017] <Notice>: PassBook Pass download failed: The pass cannot be read because it isn't valid.

pass.json 有一个团队标识符 "teamIdentifier":"5w2h"

根据您的签名文件,您的团队标识符是 WY92JHSJ83。修复您的团队标识符,然后重试。

您还可以删除 background.pngthumbnail.png,因为它们不是优惠券格式通行证的有效图像。

关于PHP 生成的通行证未安装在 iPhone 上的钱包中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38784507/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com