恢复已完成交易已损坏?

发布于 2024-10-31 10:13:18 字数 999 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

━╋う一瞬間旳綻放 2024-11-07 10:13:18

如果您在沙盒环境中进行测试并且您的测试用户已损坏,这种情况仍然可能(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

一梦等七年七年为一梦 2024-11-07 10:13:18

请确保在使用之前添加观察者 [[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];

北风几吹夏 2024-11-07 10:13:18

产品消耗品无法恢复。

产品非消耗品可以恢复。

检查您的产品类型是否为非消耗品

Products Consumable cannot be restored.

Products Non-Consumable can be restored.

Check if your products are type Non-Consumable.

渔村楼浪 2024-11-07 10:13:18

我能够解决这个问题,但这很奇怪。在我的测试设备上,我被 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.

二手情话 2024-11-07 10:13:18

如果您收到 paymentQueueRestoreCompletedTransactionsFinished,则不需要 UpdatedTransactions 回调。 “队列”有您的交易列表,您可以循环浏览这些交易。

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
    for (SKPaymentTransaction *transaction in queue.transactions) 
        if ([myItem.productID isEqualToString:transaction.payment.productIdentifier])
            myItem.purchased = YES;
}

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.

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
    for (SKPaymentTransaction *transaction in queue.transactions) 
        if ([myItem.productID isEqualToString:transaction.payment.productIdentifier])
            myItem.purchased = YES;
}
梦晓ヶ微光ヅ倾城 2024-11-07 10:13:18

确保 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.

青春有你 2024-11-07 10:13:18

此处未提及的另外两点:

  1. 如果您使用 Firebase,请确保在初始化 Firebase 之前添加观察者,https://firebase.google.com/docs/analytics/get-started?platform=ios
  2. 确保您调用 处理购买时的 finishTransaction 方法。您将无法恢复未完成的交易。

Two additional points which weren't mentioned here:

  1. If you are using Firebase make sure you add an observer before you initialize Firebase, https://firebase.google.com/docs/analytics/get-started?platform=ios
  2. Make sure that you call finishTransaction method while handling the purchase. You won't be able to restore not completed transactions.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文