Turning off an in-app purchase? Turning off an in-app purchase? xcode xcode

Turning off an in-app purchase?


When using [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];, Apple will return all completed transactions in a SKPaymentQueue which is a collection of transactions. The transaction will contain the the payment object. The payment object will contain the productIdentifier. This info is available despite your deletion. Thus you may honor past purchases that are no longer for purchase.

Here is some example code:

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];#pragma mark SKPayment Observer Delegate methods- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue{    NSLog(@"received restored transactions: %i", queue.transactions.count);    for (SKPaymentTransaction *transaction in queue.transactions)    {        NSLog(@"tran for product: %@ of state: %i", [[transaction payment] productIdentifier], [transaction transactionState]);        switch ([transaction transactionState])        {            case SKPaymentTransactionStateRestored:                NSLog(@"found restored transaction: %@ productIdentifier: %@", transaction.transactionIdentifier, transaction.payment.productIdentifier);                [self yourRestoreProcessSelector:transaction];                break;            default:                break;        }    }}