恢复已完成交易已损坏?
SDK 4.3 中的restoreCompletedTransactions 是否损坏?
我正在尝试恢复我的自动续订订阅。它不会导致对 UpdatedTransactions 的回调。这是我的代码。
{
....
[appDelegate.inapp loadStore];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
....
}
期待对 UpdatedTransactions 的回调,但没有收到。
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"IN updatedTransactions, transaction.transactionState");
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
...
...
case SKPaymentTransactionStateRestored:
NSLog(@"IN updatedTransactions, SKPaymentTransactionStateRestored");
[self restoreTransaction:transaction];
break;
}
}
}
但我最后确实接到了这样的电话。
-(void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
}
Is restoreCompletedTransactions broken in SDK 4.3 ?
I am trying to restore my auto-renewable subscription. It is not resulting in callback to updatedTransactions. Here is my code.
{
....
[appDelegate.inapp loadStore];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
....
}
Expecting callback to updatedTransactions, but do not receive it.
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"IN updatedTransactions, transaction.transactionState");
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
...
...
case SKPaymentTransactionStateRestored:
NSLog(@"IN updatedTransactions, SKPaymentTransactionStateRestored");
[self restoreTransaction:transaction];
break;
}
}
}
But I do receive call to this at the end.
-(void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您在沙盒环境中进行测试并且您的测试用户已损坏,这种情况仍然可能(1) 发生。在 iTunes Connect 中创建一个新的测试用户,然后重试。
目前尚不完全清楚是什么导致测试用户变差;据我所知,在非沙箱环境中使用它们一次可以做到这一点,但也可能有其他原因。
(1) Xcode 4.3.1、iOS SDK 5.1
This can still(1) happen if you're testing in the Sandbox environment and your Test User is broken. Create a new Test User in iTunes Connect, and try again.
It's not entirely clear what makes Test Users go bad; from what I gather, using them once in a non-sandbox environment can do this, but there may be other reasons as well.
(1) Xcode 4.3.1, iOS SDK 5.1
请确保在使用之前添加观察者
[[SKPaymentQueue defaultQueue] RestoreCompletedTransactions];
您的代码应类似于:
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueuedefaultQueue]restoreCompletedTransactions];
Make sure to add observer before using
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
Your code should be something like:
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
产品消耗品无法恢复。
产品非消耗品可以恢复。
检查您的产品类型是否为非消耗品。
Products Consumable cannot be restored.
Products Non-Consumable can be restored.
Check if your products are type Non-Consumable.
我能够解决这个问题,但这很奇怪。在我的测试设备上,我被 iTunes 窃听以登录多个测试用户帐户。我通常只是点击取消并使用我想要恢复的帐户测试我的恢复。这次我决定为这些其他烦人的登录框输入密码。它起作用了,下次我重新启动我的应用程序并点击恢复时,它并没有让我登录其他测试帐户,只是我正在测试的帐户。我继续进行恢复,它确实恢复了我想查看的项目。
我想说的是,我们遇到了愚蠢的沙盒问题,而且我们也知道苹果在应用程序购买方面已经发生了总体变化。继续尝试它,你就会成功的。
希望这对您有帮助。
I was able to get around this but its very odd. On my testing device im getting bugged by iTunes to log in to multiple test user accounts. I usually just hit cancel and test my restore with the account that I want to restore. This time I decided to enter the password for these other annoying login boxes. It worked and next time I relaunched my app and hit restore it did not bug me to log in to the other test accounts, just the one I was testing. I proceeded with the restore and it did restore the items I wanted to see.
Id say were experinecing stupid sandbox issues and also we know apple has changed in app purchasing in general. Keep playing around with it, you'll get it to work out.
Hope this helps you out.
如果您收到 paymentQueueRestoreCompletedTransactionsFinished,则不需要 UpdatedTransactions 回调。 “队列”有您的交易列表,您可以循环浏览这些交易。
You should not need the updatedTransactions callback if you are getting paymentQueueRestoreCompletedTransactionsFinished. The "queue" has a list of your transactions and you can loop thru those.
确保 Xcode 中的内部版本号中没有空格。例如“1.0 测试版”。有了空间updatedTransactions将不会被调用。收据验证也可能失败。
Make sure your build number in Xcode does not have a space in it. For example "1.0 Beta". With a space updatedTransactions will not be called. Also receipt verification can fail.
此处未提及的另外两点:
Two additional points which weren't mentioned here: