我遵循了手册https://developer.apple.com/notifications/safari-push-notifications/。我使用PHP脚本生成所需的存档。 它已创建并下载(元素的结构与手册中的相同)。
website.json具有正确的结构和有效的JSON文件...
{
"websiteName": "Safari Push Demo",
"websitePushID": "web...",
"allowedDomains": ["https://..."],
"urlFormatString": "https://...",
"authenticationToken": "19f8d7a...be957043",
"webServiceURL": "https://..."
}
manifest.json具有正确的结构和有效的JSON文件...
{
"icon.iconset\/icon_16x16.png": "e675cb16...9a38ce0",
"icon.iconset\/icon_16x16@2x.png": "920249e14c...067305bd0",
"icon.iconset\/icon_32x32.png": "920249e14c2...305bd0",
"icon.iconset\/icon_32x32@2x.png": "067fed2988...1b7e5578c21",
"icon.iconset\/icon_128x128.png": "f4260435....7efeb5fde9",
"icon.iconset\/icon_128x128@2x.png": "5fe1cd6488...3ebc14654f627",
"website.json": "eeb81434deab....3bf2d9bd2265"
}
显示所有图标和签名文件。 证书具有适当的访问权限0644。
此manual用于生成和下载.zip文件 按照Apple手册中的建议简单地传递了标题:
header("Content-type: application/zip");
echo file_get_contents($packagePath);#my path to .zip file
尝试过以下选项: 1)
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/zip");
// header("Content-type: application/octet-stream");#tried and so, too
header("Content-Disposition: attachment; filename=\"pushPackage.zip\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($packagePath));
ob_end_flush();
readfile($packagePath);#my path to .zip file
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=pushPackage.zip");
header("Content-length: " . filesize($packagePath));
header("Pragma: no-cache");
header("Expires: 0");
readfile($packagePath);
档案已下载并打开,但是APN不想接受它们,并且在'webServiceURL / version / log'上,我一直{"logs":["Extracting push notification package failed"]}
有一个question也有类似的问题,但没有解决方案。由于我的声誉,我无法发表评论,因此我决定再次询问有关我尝试过的事情的详细信息。