Sep 18, 2024
0
Level 2
Laravel passes: Invalid or uninitialized Zip object
Hi there, I'm using this package: https://github.com/chiiya/laravel-passes . Currently I have a working google pass, but I'm running into this error: Invalid or uninitialized Zip object, when creating an Apple pass. I know this is not exactly a Laravel related issue. But their github page does not allow to create discussions or create issues. Currently this is my code ``` public function createApplePass(Request $request) { $uniqueId = uniqid();
$pass = new GenericPass([
'serialNumber' => $uniqueId,
'description' => 'Apple Card',
'organizationName' => '.',
'passTypeIdentifier' => '****',
'teamIdentifier' => '*****',
]);
$barcode = new Barcode([
'format' => 'PKBarcodeFormatQR',
'message' => 'https://my.app/sample-url',
'messageEncoding' => 'iso-8859-1',
]);
$pass->barcodes = [$barcode];
$pass->backgroundColor = 'rgb(0, 100, 255)';
$pass->labelColor = 'rgb(255, 255, 255)';
$logoPath = storage_path('app/public/img/layout/logo.png');
if (file_exists($logoPath) && mime_content_type($logoPath) === 'image/png') {
$pass->addImage(new Image($logoPath, ImageType::ICON, 1));
$pass->addImage(new Image($logoPath, ImageType::LOGO, 1));
} else {
throw new \Exception('Icon and logo images must exist at ' . $logoPath . ' and be valid PNG files.');
}
// $signedPass = $this->builder->apple()->create($pass);
$factory = new PassFactory();
$factory->setCertificate(config('passes.apple.certificate'));
$factory->setPassword(config('passes.apple.password'));
$factory->setWwdr(config('passes.apple.wwdr'));
$factory->setOutput(config('passes.apple.disk'));
$factory->create($pass, 'filename');
// return response()->make($signedPass, 200, [
// 'Content-Type' => 'application/vnd.apple.pkpass',
// 'Content-Disposition' => 'attachment; filename="pass.pkpass"',
// ]);
}
Please or to participate in this conversation.