Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAlertView enter Apple ID and Password IAP

When I start test my IAP the system requests me apple id and password. There is an alert view with ok and cancel buttons.

I need to handle this button, because when I press on cancel button I need to make some action in app.

Very important: there is an autorize dialog not a purchase alert. I need to know how to process this action in app (for example if user tap on cancel button and after this autorize dialog disappear)

like image 666
Matrosov Oleksandr Avatar asked Jul 22 '12 22:07

Matrosov Oleksandr


2 Answers

If you see only an authorize alert, not a purchase alert, that means you are trying to restore purchases.

If user taps on cancel button on authorize dialog, this delegate method gets called:

- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error;
like image 53
erkanyildiz Avatar answered Nov 13 '22 01:11

erkanyildiz


You have to handle this case in failedTransaction delegate message:

- (void)failedTransaction:(SKPaymentTransaction *)transaction
{
    if (transaction.error.code != SKErrorPaymentCancelled)
    {
        // error!
    }
    else
    {
        // this is fine, the user just cancelled
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
    }
}
like image 3
catlan Avatar answered Nov 13 '22 01:11

catlan