简体   繁体   English

在应用程序内购买

[英]In App Purchase

I have a peculiar situation.我有一个特殊的情况。 After I pay up for the transaction and before I receive the SKTransactionStatePurchased notification from App store, I close my application.在我为交易付款后,在我收到来自 App Store 的 SKTransactionStatePurchased 通知之前,我关闭了我的应用程序。 After closing my application, I get this alert "Your purchase was successful".关闭我的应用程序后,我收到此警报“您的购买成功”。 Now, it all happens in such a way that I couldn't call,现在,这一切都以我无法调用的方式发生,

[[SKPaymentQueue defaultQueue] finishTransaction: transaction]; [[SKPaymentQueue defaultQueue] finishTransaction: 交易];

and I couldn't unlock the functionality because before processing the updated transaction, my app quits.而且我无法解锁该功能,因为在处理更新的交易之前,我的应用程序退出了。 It doesn't enter the background, I kill it.它不进入后台,我杀了它。 Now how do I deal with this particular situation.现在我该如何处理这种特殊情况。 Even if the I try the purchase again, I get this message, This purchase has already been made but not downloaded.即使我再次尝试购买,我也会收到此消息,此购买已完成但未下载。 May be it's because I am not finishing the transaction.可能是因为我没有完成交易。 If I try calling restore transaction, I don't get the correct response for this unfinished transaction.如果我尝试调用恢复事务,我不会得到这个未完成事务的正确响应。

How to deal with this situation?如何处理这种情况? It is different from apple automatically responding to unfinished queries.它不同于苹果自动响应未完成的查询。 Here the app store responds and frees itself of it's duties but before I could unlock and deliver the functionality and finish the transaction, my app gets killed may be due to an incoming call or something.在这里,应用商店做出响应并释放自己的职责,但在我解锁并交付功能并完成交易之前,我的应用被杀死可能是由于来电或其他原因。

Thanks in Advance提前致谢

FYI, our app deals only with consumables, so this might not apply to you.仅供参考,我们的应用程序仅处理消耗品,因此这可能不适用于您。

However, in cases where we couldn't successfully finish the transaction, our transactions are usually returned in the state SKPaymentTransactionStatePurchased on restarting the app.但是,在我们无法成功完成交易的情况下,我们的交易通常会在重新启动应用程序时返回到 state SKPaymentTransactionStatePurchased 中。 Then we simply do the finishTransaction and the universe is in balance once again.然后我们简单地执行finishTransaction,宇宙再次处于平衡状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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