-(IBAction)goRestore
{
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}
//委托方法
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
NSLog(@"Access Apple successfully");
NSMutableArray *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];
NSLog(@"Lan thu %i tra ve ID = %@",[purchasedItemIDs count],productID);
}
//purchasedItemIDs you get all purchase product identifier and compere from your side
}
-(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error{
NSLog(@"Error when purchasing: %@",error);
}