IOS in-app-purchase recovery returns many transactions

When I restore my previous purchase. Storekit calls updateTransations with a lot of previous transactions. I don’t know why he returns these large sums, such as 100, 200, 245, 360, 650, it seems random at each recovery.

Is it only in the sandbox? If not, what should be the criteria for selecting an item. Do I have many items with the same product id?

+2
source share
1 answer

There have been many complaints about using updateTransactions for recovery. The code below will work, but it requires the user to enter their username and password. (while developers stick to this in an IBAction call that requires a button)

 [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; 

Then the next delegate is called.

 - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue { for (SKPaymentTransaction *transaction in queue.transactions) { if ([myItem.productID isEqualToString:transaction.payment.productIdentifier]) { myItem.purchased = YES; } } } 

I want to know how to do this without putting the β€œrestore” button on my interface if there are no elements that need to be restored.

+3
source

Source: https://habr.com/ru/post/918384/


All Articles