iPhone - in-app purchase testing for failure

佐手、 提交于 2020-01-03 02:56:15

问题


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.

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).

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.

thanks


回答1:


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.



来源:https://stackoverflow.com/questions/6720616/iphone-in-app-purchase-testing-for-failure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!