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)
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;
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];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With