ios – paymentQueue:updatedTransactions:在恢复期间未调用

ios – paymentQueue:updatedTransactions:在恢复期间未调用,第1张

概述在极少数情况下,我的一些用户似乎无法进行非消耗品购买.当他们尝试购买时,它不会激活“premium”,当他们从当前安装或全新安装中恢复时,我们不会调用updateQnsaction:updatedTransactions: 我已经添加了大量日志记录,专门用于尝试确定还原未遵循预期流量的原因.在恢复失败期间,不会触发任何“RESTORE”类别事件. 供参考[自我成功];只显示内容视图,[self f 在极少数情况下,我的一些用户似乎无法进行非消耗品购买.当他们尝试购买时,它不会激活“premium”,当他们从当前安装或全新安装中恢复时,我们不会调用updateQnsaction:updatedTransactions:

我已经添加了大量日志记录,专门用于尝试确定还原未遵循预期流量的原因.在恢复失败期间,不会触发任何“RESTORE”类别事件.

供参考[自我成功];只显示内容视图,[self fail:]会向用户显示错误消息.

另外[[SKPaymentQueue defaultQueue] addTransactionObserver:self];在vIEwDIDLoad和[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]中调用;在按下按钮时调用.

- (voID)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {    // COMPLETION POINT - RESTORE COMPLETE***    [MBProgressHUD hIDeHUDForVIEw:self.vIEw animated:TRUE];    if ([SKPaymentQueue defaultQueue].transactions.count == 0) {        [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"RESTORE"                                                                   action:@"failure_hard"                                                                    label:@"no_purchases"                                                                    value:nil] build]];        [self fail:@"There are no items available to restore at this time."];    } else {        [self success];    }}- (voID)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {    // COMPLETION POINT - RESTORE Failed    [MBProgressHUD hIDeHUDForVIEw:self.vIEw animated:TRUE];    [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"RESTORE"                                                               action:@"failure_hard"                                                                label:error.localizedDescription                                                                value:nil] build]];    [self fail:error.localizedDescription];}- (voID)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {    // Make sure completion states call [[SKPaymentQueue defaultQueue] finishTransaction:transaction];    // in order to prevent sign in popup    // https://stackoverflow.com/a/10853107/740474    [MBProgressHUD hIDeHUDForVIEw:self.vIEw animated:TRUE];    for (SKPaymentTransaction *transaction in transactions) {        switch (transaction.transactionState) {            case SKPaymentTransactionStatePurchasing:                break;            case SKPaymentTransactionStateDeferred:                break;            case SKPaymentTransactionStateFailed:                // COMPLETION POINT - PURCHASE Failed                [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"PURCHASE"                                                                           action:@"failure_hard"                                                                            label:transaction.error.localizedDescription                                                                            value:nil] build]];                if (transaction.error.code != SKErrorPaymentCancelled) {                    // only show error if not a cancel                    [self fail:transaction.error.localizedDescription];                }                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];                break;            case SKPaymentTransactionStatePurchased:                // COMPLETION POINT - PURCHASE SUCCESS                if ([transaction.payment.productIDentifIEr isEqualToString:(Nsstring*)productID]) {                    // premium purchase successful                    [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"PURCHASE"                                                                               action:@"success"                                                                                label:nil                                                                                value:nil] build]];                    [Utils setPremium:YES];                    [self success];                } else {                    [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"PURCHASE"                                                                               action:@"failure_hard"                                                                                label:@"no_ID"                                                                                value:nil] build]];                    [self fail:@"The item you purchased was not returned from Apple servers. Please contact us."];                }                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];                break;            case SKPaymentTransactionStateRestored:                if ([transaction.payment.productIDentifIEr isEqualToString:(Nsstring*)productID]) {                    // premium purchase restored                    [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"RESTORE"                                                                               action:@"restore_success"                                                                                label:nil                                                                                value:nil] build]];                    [Utils setPremium:YES];                } else {                    [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"RESTORE"                                                                               action:@"failure_hard"                                                                                label:@"no_ID"                                                                                value:nil] build]];                }                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];                break;            default:                // For deBUGging                   [self.tracker send:[[GAIDictionaryBuilder createEventWithcategory:@"STORE"                                                                           action:@"transaction_weird"                                                                               label:[Nsstring stringWithFormat:@"Unexpected transaction state %@",@(transaction.transactionState)]                                                                            value:nil] build]];                break;        }    }}

任何建议,将不胜感激

解决方法 你有没有实现以下方法:

>(voID)请求:(SKRequest *)请求dIDFailWithError:(NSError *)错误NS_AVAILABLE_IOS(3_0);

这是SKRequestDelegate的可选方法之一.

我们也遇到了丢失恢复购买电话的同样问题.处理这个代表帮助了我们.由于任何原因甚至没有被送到队列的所有请求都在此失败委托中提供.

所以,我认为你可能面临同样的问题.

总结

以上是内存溢出为你收集整理的ios – paymentQueue:updatedTransactions:在恢复期间未调用全部内容,希望文章能够帮你解决ios – paymentQueue:updatedTransactions:在恢复期间未调用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1073303.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存