From iOS7, Apple has deprecated the transactionReceipt property of the SKPaymentTransaction instance, and now we have one large receipt containing everything. In my application, I have several spending purchases. My code is:
#pragma mark -
#pragma mark SKPaymentTransactionObserver
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
...
}
}
- (void)completeTransaction:(SKPaymentTransaction *)transaction {
[self testMainReceipt];
[self deliverPurchaseNotificationFirIdentifier:transaction.payment.productIdentifier];
[SKPaymentQueue.defaultQueue finishTransaction:transaction];
}
- (void)testMainReceipt {
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
[self sendRecieptToServer:receipt];
}
From Apple's answer, I see "in_app" filed with an array, always containing 1 element - the most recent purchase, no matter how many times I have made purchases before. Is it right that this concerns how consumer purchases work? And do I always get an array with 1 point and "status" for this last purchase? Or is there his best way?
source
share