SKPaymentTransactionObserver没有在应用程式切换回应 [英] SKPaymentTransactionObserver not getting a callback on app switch

查看:1127
本文介绍了SKPaymentTransactionObserver没有在应用程式切换回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了应用内购买,以便在用户点击购买按钮时,会显示请稍候视图,并将付款添加到付款队列中。这总是导致队列的观察者的立即回调,说交易进入采购状态。

I have in-app purchases set up so that when a user clicks on the buy button, a "Please Wait" view appears and adds a payment to the payment queue. This always causes an immediate callback of the queue's observer saying that the transaction entered the "Purchasing" state.

当用户在确认之前返回主屏幕时,要购买对话框弹出,然后取消。如果我在主屏幕上等待一段时间,然后切换回应用程序,则应用程序不会获得有关事务切换状态或被删除的任何回调。如果我检查支付队列,我可以看到,交易仍在队列中,仍然处于采购状态。在恢复应用程序后,有什么我可以做的,让它回调并将其从队列中删除?

My problem happens when the user returns to the main screen before the confirm to purchase dialog pops up, then cancels. If I wait around on the main screen awhile before switching back to the application, the application never gets any callback about the transaction switching state or being removed. If I examine the payment queue, I can see that the transaction is still in the queue, still in the "Purchasing" state. Is there anything I can do to make it call back and remove it from the queue after resuming the application?

推荐答案

您的情况正确,您遇到了此问题:

If I understood your situation correctly, you've encountered this problem:

在应用程序购买用户取消tx,而应用程序在后台:tx状态保持购买

这似乎是苹果商店套件中的一个错误。如果您在启动购买后立即将应用程序发送到后台,然后在提示购买确认弹出窗口时按取消按钮,则可以轻松地重现此问题。您的应用程式永远不会收到交易失败(已取消)的通知,并会进入封锁状态(如果您在购买完成后停用使用者介面,无法与使用者互动)。

This appears to be a bug in Apple's Store kit. The issue can easily be reproduced if you send your app to background right after initiating a purchase and then pressing the cancel button when the buy confirmation popup is prompted. Your app will never receive the transaction failed(cancelled) notification and will enter a blocked state (if you disabled the UI trying to prevent the user from interacting with the app until the purchase has finished).

我们必须等待苹果的修复。在此期间,如果您的应用程式进入封锁状态,因为您在购物时停用了使用者介面;您应该实现一些允许用户离开该状态的机制。

We have to wait for a fix from Apple. In the meantime, if your app is entering a blocked state because you disable UI while making a purchase; you should implement some mechanism to allow the user to leave that state.

祝你好运!

这篇关于SKPaymentTransactionObserver没有在应用程式切换回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆