I'm having some problems restoring completed transactions.
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
I've added the observer mentioned in several examples, I've tried adding paymentQueueRestoreCompletedTransactionsFinished
and already have updatedTransactions
. paymentQueueRestoreCompletedTransactionsFinished
says I have zero transactions.
I can buy a product and if I try to buy again, it stops me and says I've already bought the product, using this code.
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productIdentifier];
[[SKPaymentQueue defaultQueue] addPayment:payment];
I thought maybe I had a problem with my bundle identifier, but that seems fine and the buy wouldn't work if it wasn't.
I have been trying this on the device as well as the simulator, but this has the same result. Also, it doesn't make a difference If I'm using UK or US store.
I'm really grasping at straws to find out why this doesn't work for me ?
try to do it like this and check the array count is it return zero also ?
- (void) checkPurchasedItems
{
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}//You Call This Function
//Then this delegate Function Will be fired
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
purchasedItemIDs = [[NSMutableArray alloc] init];
NSLog(@"received restored transactions: %i", queue.transactions.count);
for (SKPaymentTransaction *transaction in queue.transactions)
{
NSString *productID = transaction.payment.productIdentifier;
[purchasedItemIDs addObject:productID];
}
}
According to the docs:
When you create a new product to be sold in your store, you choose whether that product can be restored or not.
So the question is, is your product configured to allow restores?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With