My app was rejected for not implementing "Restore Purchases" feature.
Apple says
We found that your app offers In-App Purchase/s that can be restored but it does not include a "Restore" feature to allow users to restore the previously purchased In-App Purchase/s. To restore previously purchased In-App Purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped.
So I finally decided to add that and I found we have to use
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
But it doesn't help! I searched for similar questions but found none working for my app. These are the following links that I have stacked so far :
Restore already bought in-app-purchases on iPhone?
iOS6 - In app purchase with download from Apple server
Please help!! Thanks in advance..
Try the following :
On Restore button click -->
- (IBAction)retoreinApp:(id)sender
{
//set addTransactionObserver to self.
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}
This will call
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
UIAlertView *alert ;
if(queue.transactions.count >0)
{
for (SKPaymentTransaction *transaction in queue.transactions)
{
NSString *productId = transaction.payment.productIdentifier;
NSLog(@" ProductIdentifier is %@",productId);
if([productId isEqualToString:@"com.xy.yourProductId"])
{//add code to add it to your account
}
alert = [[UIAlertView alloc ] initWithTitle:@"Restore Transactions" message:@"All your previous transactions are restored successfully." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
}
else
{
alert = [[UIAlertView alloc ] initWithTitle:@"Restore Transactions" message:@"No transactions in your account to be restored." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
}
[alert show];
}