ios - IAP iOS UIAlertView 取消按钮

标签 ios in-app-purchase uialertview

我正在使用 StoreKit 在我的应用程序中实现购买。我的问题是当 IAP 对话框出现时我如何处理 UIAlertView。我需要处理取消按钮。我需要知道何时按下取消并通知我的系统。我需要处理请求我的用户和密码数据的警报 View 上的取消按钮。

例如,如果用户点击取消按钮,它应该调用一些回调方法。

最佳答案

可以在SKPaymentTransactionObserver中处理

像这样

- (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;
        }
    }
}

关于ios - IAP iOS UIAlertView 取消按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11602593/

相关文章:

iOS CALayer 点击识别器

ios - 在同一 UILabel 上的两个不同文本之间重复淡入/淡出

iphone - 在 UITableViewCell 中设置 textLabel 的宽度

java - Play Billing Library v1.0 过期订阅

android - 如何让用户在 Android 应用内购买中反复购买相同的产品

ios - 在所有 View Controller 中创建警报功能 - swift

ios - 如何在触摸 UIAlertView 之外的任何地方时关闭它?

ios - 更新 ios 应用程序是增加内部版本号还是只增加版本?

ios - 打开应用程序 3 次后显示 uialertview?

android - Amazon IAP在 Release模式下不起作用