简体   繁体   中英

Handling the selection of Cancel in iOS 7 native login popup

I am writing some in-app purchase related code. When I initiate the in-app purchase, iOS pops up a native login popup as shown in the image below. I am also starting to animate a UIActivityIndicatorView. If the user selects the Cancel option, I want to stop animating the UIActivityIndicatorView. What is the way to handle the selection of Cancel in iOS 7 native login popup.

iOS 7本机登录弹出窗口

The following function is not being called:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 - (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error 

above method get called when user presses cancel on restore alert.

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [self completeTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction];
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
            default:
                break;
        }
    }
}

When user presses the cancel button SKPaymentTransactionStateFailed get called,
NOTE: This is not always the case, this also get called for some other response also

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM