2016-08-05 1 views
0

私はこのpassgeneratorライブラリを使用して.pkpassを生成しています。これはiPhoneのApple Walletにインストールされています。 .pkpassファイルは正常に生成されますが、iPhoneの「wallet」に追加できませんでした。電子メール添付ファイルからこのファイルを開こうとするとエラーは表示されません。 Mac上で "Pass Viewer"で開くと、バーコード領域に何らかのエラーが表示されます。ここにスクリーンショットがあります。私が何か間違ったことをやっているところPHPで生成されたパスがiPhoneのウォレットにインストールされていません

coupon

私は知りません。私はlaravel 5.1を使用しています。私はこのパッケージを正しく必要としており、証明書パスを設定するための環境変数を設定するようにドキュメントが要求されています。

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

ここで私の設定は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; 
    } 

ご協力いただければ幸いです。私が設定や他のどこかに何か悪いことをしているかどうか教えてください。

+0

Xcodeログは何を表していますか? MacまたはXcodeをお持ちでない場合は、.pkapssバンドルへのリンクを投稿できますか? JSONに有効期限が設定されていないので、パスID ID証明書が期限切れになっているか、取り消されているため、バーコードがグレー表示されている可能性があります。 – PassKit

+0

また、セカンダリラベルに空の文字列があります。そのキーを削除するか、スペースを追加してください。 null文字列はエラーを引き起こします。 – PassKit

+0

@PassKit 2次フィールドを変更しましたが、影響はありません。あなたは私にあなたの電子メールアドレスを提供できるので、私はあなたにパスパッケージの電子メールを送ることができます。 –

答えて

1

あなたの署名に問題があります。

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です。チームIDを修正して、もう一度やり直してください。

また、background.pngthumbnail.pngは、クーポン形式での有効な画像ではないため、削除することができます。

+0

ありがとうございます@PassKit。あなたは人生保護人です。私はどのようにこれらのログをデバッグのために行ったのか確認できますか教えてください。 –

+1

iPhone、Mac、Xcodeが必要です。あなたのiPhoneをMacに接続してから、XcodeでWindow-> Devicesを選択し、あなたのデバイスを選択します。ログは下部ペインに出力されます。 – PassKit

関連する問題