私のアプリの動的クーポンを作成しようとしています。私はそれらを作成するPHPサーバを持っています。しかし、私はなぜ彼らは通帳で動作しないのか分からない。PHPで通帳のパスを作成
私は、ターミナルからのパスを作成する場合は正常に動作します。しかしPHP-PKPassを使ったPHPでは。
は、私は(私は電子メール経由で送信もあれば)私のコンピュータにパスを表示されますが、それは通帳に追加されません。その下にPHPのコードを残しイム100%必ずそのpassTypeIdentifier、teamIdentifier 、証明書とWWDRは正しく
注100%:すべての画像は、私はあなたのパスをインストールしようとしたとして、私は次の警告が表示されるコンソール出力を見てみると
<?php
include ("conexion.php");
require('passpk/PKPass.php');
if (isset($_GET['cupon']) and $_GET['cupon'] != '' and $_GET['cupon'] > 0) {
$cuponID = $_GET['cupon'];
$pass = new PKPass\PKPass();
$pass->setCertificate('./Certificate.p12'); // 2. Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('*******'); // 2. Set password for certificate
$pass->setWWDRcertPath('./WWDR.pem'); // 3. Set the path to your WWDR Intermediate certificate (.pem file)
// Top-Level Keys http://developer.apple.com/library/ios/#documentation/userexperience/Reference/PassKit_Bundle/Chapters/TopLevel.html
$standardKeys = array(
'description' => 'Store',
'formatVersion' => 1,
'organizationName' => 'Store',
'passTypeIdentifier' => 'pass.store.store', // 4. Set to yours
'serialNumber' => $cupon['id'],
'teamIdentifier' => '********' // 4. Set to yours
);
$associatedAppKeys = array();
$relevanceKeys = array();
$styleKeys = array(
'coupon' => array(
'primaryFields' => array(
array(
'key' => 'key',
'label' => "Label"
)
),
'secondaryFields' => array(
array(
'key' => 'name',
'label' => 'Tienda',
'value' => "Name"
),
array(
'key' => 'date',
'label' => 'Válido hasta',
'value' => "Vigencia"
)
),
'backFields' => array(
array(
'key' => 'tienda',
'label' => 'Tienda',
'value' => "tienda"
),
array(
'key' => 'sucursales',
'label' => 'Sucursales',
'value' => 'Valido en las sucursales y sus horarios'
),
array(
'key' => 'description',
'label' => 'Descripción',
'value' => "descr"
),
array(
'key' => 'terms',
'label' => 'Términos y Condiciones',
'value' => "cupon"
)
)
)
);
$visualAppearanceKeys = array(
'barcode' => array(
'format' => 'PKBarcodeFormatPDF417',
'message' => "cupon",
'messageEncoding' => 'iso-8859-1'
),
'foregroundColor' => 'rgb(255, 255, 255)',
'backgroundColor' => 'rgb(4, 148, 203)',
'logoText' => 'cupon'
);
$webServiceKeys = array();
// Merge all pass data and set JSON for $pass object
$passData = array_merge(
$standardKeys,
$associatedAppKeys,
$relevanceKeys,
$styleKeys,
$visualAppearanceKeys,
$webServiceKeys
);
$pass->setJSON(json_encode($passData));
//creating a temp file called strip.png
//generamos un directorio temporal y creamos el strip
$uniqID = uniqid('', true);
$dir = './tempDir/'.$uniqID;
mkdir($dir, 0777);
//copiamos el archvio al nuevo directorio
copy('../'.$img, './tempDir/'.$uniqID.'/strip.png');
// Add files to the PKPass package
$pass->addFile($dir.'/strip.png');
$pass->addFile('images/icon.png');
$pass->addFile('images/[email protected]');
$pass->addFile('images/logo.png');
$pass->addFile('images/[email protected]');
if(!$pass->create(true)) { // Create and output the PKPass
echo 'Error: '.$pass->getError();
}
//borramos el folder temp
unlink($dir.'/strip.png');
rmdir($dir);
}
あなたのデバイスにパスをインストールすると、コンソールに何が表示されますか(これを見るにはiPhoneをMacに接続し、Xcodeを起動してウィンドウ - >オーガナイザをクリックします)。 – PassKit
iPhoneでcupon.pkpassのように見えるのでインストールできません – Edig
Safariはファイルをパスファイルとして認識しないため、Safariがファイルをダウンロードしている可能性があります。これは 'Content-Type:application/vnd.apple.pkpass'ヘッダー? – PassKit