BOM couldn't extract the archive. exception in initialising pkpass with the pass url which is generated using passkit

StackOverflow https://stackoverflow.com/questions/20990140

문제

When trying to display the pass within my app using the following code, I am getting the error "BOM could not extract the archive. PKpass signature missing exception constantly". Please help me to get ride of this exception.

NSURL *url = [NSURL URLWithString:urlString];
NSData *passData = [NSData dataWithContentsOfUrl: url];
PKPass *pass = [[PKPass alloc] initWithData:passData error:&err];

I am using Xcode 5.2 for the development and mashape to generate passes.

도움이 되었습니까?

해결책

Assuming that your question relates to the PassKit API on Mashape, you need to append .pkpass to the end to the URL that is returned from the issue request.

The raw URL delivers a contextual response depending on whether or not it is being called from a Passbook capable browser (try accessing the URL via Firefox on on an Android device).

In your case, [NSData dataWithContentsOfUrl: url]; is receiving a HTML response which is causing PKPass to complain that it cannot extract the archive, and subsequently cannot find a signature.

Appending .pkpass to the URL forces the API to deliver the raw .pkpass bundle.

So if your response is:

{
  "success"        : true,
  "serial"         : "7114189133818574",
  "url"            : "https://r.pass.is/b93NuXKuX1Tj",
  "passbookSerial" : "1fBHoUz9zOOk0yGs47wDC",
  "shareID"        : "2HcFlmRLblKdQZsa4W9zkc",
  "uniqueID"       : "b93NuXKuX1Tj"
}

urlString should be https://r.pass.is/b93NuXKuX1Tj.pkpass.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top