IAP iOS UIAlertView cancel button

in-app-purchase, ios, uialertview

Solution

You can handle it in SKPaymentTransactionObserver

Something like this

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                break;
            case SKPaymentTransactionStateFailed:
            {
               if (transaction.error.code == SKErrorPaymentCancelled)
               {
                   //user cancelled purchase
                }
             }  
                break;
            case SKPaymentTransactionStateRestored:
                break;
            default:
                break;
        }
    }
}

Problem

I'm using StoreKit for implement purchacing in my app. My question is how can I hendle UIAlertView when IAP dialog appear. I need to process Cancel button. I need to know when I press cancel and notify my system about this. I need to process cancel button that on alert view that request my user and password data. For example if user tap on cancel button it should invoke some callback method.

Original source