iPhone-应用内购买测试失败 [英] iPhone - in-app purchase testing for failure

查看:115
本文介绍了iPhone-应用内购买测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple声明所有使用应用程序内购买功能的应用程序都必须放置此内容

Apple states that all apps using in-app purchases have to put this

[[SKPaymentQueue defaultQueue] addTransactionObserver:self.observer];

在应用的开头,以处理由于某种原因设备未收到发布内容确认的任何成功交易.

at the beginning of the app to handle for any successful sale that for some reason the device has not received the confirmation to release the content.

我正在尝试测试这一点,尝试在交易即将完成时拨打电话,退出应用程序或在交易完成前停止Xcode,但是由于某些原因,即使我退出Xcode,iOS似乎也可以继续处理交易,应用程序将永远不会收到SKPaymentTransactionStateRestored.该应用程序始终会收到SKPaymentTransactionStatePurchased,并且似乎具有故障证明功能(也许新的iOS 4处理的功能要好于StoreKit发布时的3.2).

I am trying to test this, trying to call the phone when it is about to finish the transaction, quitting the application or stopping Xcode before the transaction finish, but for some reason, even when I quit Xcode, iOS appears to continue handle the transaction and the app never receives the SKPaymentTransactionStateRestored. The app always receive the SKPaymentTransactionStatePurchased and appears to be fail proof (perhaps the new iOS 4 handles that better than the 3.2 when StoreKit was released).

我的问题是:你们知道我可以在此处创建任何情况以生成故障并在应用启动时收到SKPaymentTransactionStateRestored的情况吗?我需要测试该应用程序在这种情况下是否运行良好.

My question is: do you guys know any situation I can create here to generate the failure and receive the SKPaymentTransactionStateRestored when the app starts? I need to test if the app is working well for this kind of situation.

谢谢

推荐答案

SKPaymentTransactionStateRestored仅适用于您致电restoreCompletedTransactions的情况(以便用户可以在新设备上恢复其应用内购买).如果您在不调用finishTransaction:的情况下退出应用程序,则事务将停留在队列中,并且您将再次获得SKPaymentTransactionStatePurchased.

SKPaymentTransactionStateRestored is only for when you call restoreCompletedTransactions (so a user can restore their in-app purchases on a new device). If you quit the app without calling finishTransaction:, the transaction stays in the queue and you will get SKPaymentTransactionStatePurchased again.

这篇关于iPhone-应用内购买测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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