verifyTransactionReceipt is failing to parse receipt data on iOS 9
fawkeswei opened this issue · 2 comments
fawkeswei commented
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 commented
Same issue here :/
asltig commented
Same, please help asap