IOS convert receipt to Base64.
This commit is contained in:
parent
322e48e8a7
commit
788e7b1f96
@ -261,7 +261,6 @@ static void CopyTransaction(SKPaymentTransaction* transaction, IAPTransaction* o
|
||||
|
||||
out->ident = strdup([transaction.payment.productIdentifier UTF8String]);
|
||||
|
||||
|
||||
if (transaction.transactionDate)
|
||||
out->date = strdup([[dateFormatter stringFromDate: transaction.transactionDate] UTF8String]);
|
||||
out->state = transaction.transactionState;
|
||||
@ -274,9 +273,15 @@ static void CopyTransaction(SKPaymentTransaction* transaction, IAPTransaction* o
|
||||
if (transaction.transactionState == SKPaymentTransactionStatePurchased) {
|
||||
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
|
||||
NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL];
|
||||
out->receipt_length = receiptData.length;
|
||||
|
||||
NSString *receiptString = [receiptData base64EncodedStringWithOptions:0];
|
||||
out->receipt_length = receiptString.length;
|
||||
out->receipt = (const char*)malloc(out->receipt_length);
|
||||
memcpy((void*)out->receipt, receiptData.bytes, out->receipt_length);
|
||||
memcpy((void*)out->receipt, [receiptString UTF8String], out->receipt_length);
|
||||
|
||||
// out->receipt_length = receiptData.length;
|
||||
// out->receipt = (const char*)malloc(out->receipt_length);
|
||||
// memcpy((void*)out->receipt, receiptData.bytes, out->receipt_length);
|
||||
}
|
||||
|
||||
if (transaction.transactionState == SKPaymentTransactionStateRestored && transaction.originalTransaction) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user