Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

verifyTransactionReceipt is failing to parse receipt data on iOS 9 #78

Closed
fawkeswei opened this issue Oct 1, 2015 · 2 comments
Closed

Comments

@fawkeswei
Copy link

In the following method

- (void)verifyTransactionReceipt:(NSData *)transactionReceipt
                        password:(NSString *)passwordOrNil
                         success:(void (^)(NSDictionary *responseObject))success
                         failure:(void (^)(NSError *error))failure
{
    NSError *error = nil;
    NSDictionary *receiptDictionary = [NSPropertyListSerialization propertyListWithData:transactionReceipt options:NSPropertyListImmutable format:nil error:&error];
    if (!receiptDictionary) {
        if (failure) {
            failure(error);
        }
        return;
    }

    NSString *environment = [receiptDictionary objectForKey:@"environment"];
    NSURL *endpoint = [environment isEqual:@"Sandbox"] ? [NSURL URLWithString:kCargoBaySandboxReceiptVerificationURLString] : [NSURL URLWithString:kCargoBayProductionReceiptVerificationURLString];

    [self verifyTransactionWithMethod:@"POST" endpoint:endpoint receipt:transactionReceipt password:passwordOrNil success:success failure:failure];
}

https://github.com/mattt/CargoBay/blob/master/CargoBay/CargoBay.m#L779

is failing to parse receipt data obtained from appStoreReceiptURL

NSURL *appStoreReceiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receiptData = [[NSData alloc] initWithContentsOfURL:appStoreReceiptURL];

the error

Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character 0 at line 1" UserInfo={NSDebugDescription=Unexpected character 0 at line 1, kCFPropertyListOldStyleParsingError=Error Domain=NSCocoaErrorDomain Code=3840 "Conversion of string failed." UserInfo={NSDebugDescription=Conversion of string failed.}}
@amaurydavid
Copy link

Same issue here :/

@asltig
Copy link

asltig commented Feb 17, 2016

Same, please help asap

@mattt mattt closed this as completed Jun 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants