Apple In app purchase receipt in wrong format

688 views Asked by At

I'm validating my receipts against the Appstore, following the Apple's guide. The receipt is retrieved from the bundle using the following code:

NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
NSString *base64Receipt = [receipt base64EncodedStringWithOptions:0];

The encoded receipt is a signed binary file, as described in the documentation. However, in some weird cases the receipt is not the expected binary file but a NSDictionary with the form

{
 pod = 50;
 "purchase-info" = "ewo...";
 signature = "Apdx...";
 "signing-status" = 0;
}

When I try to validate those receipts against the AppStore, the result is always 21002 ("The data in the receipt-data property was malformed or missing"). Any ideas in why the receipt retrieved from the bundle is in the wrong format?

0

There are 0 answers