में पासबुक के लिए पास बनाएँ I Im मेरे ऐप के लिए गतिशील कूपन बनाने की कोशिश कर रहा है। मेरे पास एक PHP सर्वर है जो उन्हें बनाते हैं। लेकिन मुझे नहीं पता कि वे पासबुक पर क्यों काम नहीं करते हैं।php
यदि मैं टर्मिनल से पास बनाता हूं तो यह ठीक काम करता है। लेकिन पीएचपी-पीकेपास के साथ 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 को एक मैक करने के लिए, हुक Xcode का शुभारंभ और विंडो क्लिक करें -> आयोजक)। – PassKit
आईफोन में मैं इसे इंस्टॉल नहीं कर सकता क्योंकि यह cupon.pkpass – Edig
जैसा दिखता है यह हो सकता है कि सफारी फ़ाइल डाउनलोड कर रहा है क्योंकि यह इसे पास फ़ाइल के रूप में नहीं पहचानता है - क्या आप इसे 'सामग्री-प्रकार: एप्लिकेशन' के साथ सेवा दे रहे हैं/vnd.apple.pkpass' हेडर? – PassKit