Sam Spencer
Sam Spencer

Reputation: 8609

Error when creating Passbook Pass

I am making an app for iOS which uses Passbook / PassKit. I have all of the certificates, provisioning, and IDs. However, in recent builds of my application, I've been getting these two errors when attempting to add a pass to Passbook:

Invalid data error reading card pass.PASSTYPE.ID/PASSTYPE-ID. Pass dictionary must contain key 'key'.

And:

Creation of pass failed: Error Domain=PKPassKitErrorDomain Code=1 "The pass cannot be read because it isn't valid." UserInfo=0x1c5de340 {NSUnderlyingError=0x1d5dca50 "Pass dictionary must contain key 'key'.", NSLocalizedDescription=The pass cannot be read because it isn't valid.}

This seems quite random (again, thank you Xcode 4), however I'm sure it's something I'm doing.

I'm creating the pass by connecting to a server (www.PassSlot.com) and then editing it and downloading it. Could this have to do with my internet connection (ex. HTTP vs. HTTPS or speed)? Or does it have to do with something completely different, such as an invalid entitlements file or something of the sort?

I've seen a lot of errors in Xcode, but this PassKit error is mysterious to me. Any help would be appreciated!

Upvotes: 1

Views: 2963

Answers (1)

Sam Spencer
Sam Spencer

Reputation: 8609

After lots of tedious efforts, I found that these errors appear when the pass.json file has sections such as this one:

eventTicket {
    primaryField {
       key : key
       label : label
       value : value
    }
}

But is missing the key as it says in the error. The only part that was confusing about the error was the so called passDictionary, which I had never heard the pass.json file referred to as.

As a future note, NONE of the key fields can have the same value.

Upvotes: 1

Related Questions