自动续订订阅不会自动续订

发布于 2024-12-06 22:34:37 字数 1434 浏览 1 评论 0 原文

很抱歉关于自动更新订阅的第一百万个问题,但我不明白。 我已按照苹果应用内购买指南中的说明进行了所有操作,但并没有解决问题。

我的问题是我已经创建了自动续订订阅,但它们不会自动续订。

我创建了一个 Payment Transaction Observer 类,它实现了 SKPaymentTransactionObserver 接口。该类将在应用程序启动时作为 paymentObserver 安装在 viewDidLoad: 方法中。

PaymentTransactionObserver *observer = [[PaymentTransactionObserver alloc] init];

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

在 paymenttransactionobserver 中,我有 paymentQueue:updateTransactions 方法:(与苹果文档中的描述相同)

  • (void) paymentQueue:(SKPaymentQueue *)队列更新交易:(NSArray *)transactions { for (SKPaymentTransaction *交易中的交易) {
    switch (transaction.transactionState) {

        case SKPaymentTransactionStatePurchased: 

            [self completeTransaction:transaction]; 

            break;

        case SKPaymentTransactionStateFailed: 

            [self failedTransaction:transaction]; 

            break;

        case SKPaymentTransactionStateRestored:

            [self restoreTransaction:transaction]; 

            break;

        default:

            break;
    }
}

当我购买自动续订产品时,该产品将成功购买。 但它永远不会自动续订。我想到,事务观察者会以某种方式被释放,但它不会(否则,调试器会通知我)。我也一样,我确实删除了观察者,但它永远不会被删除。

我使用调试器来确保 updateTranscations: 方法将被调用,但什么也没有。当我购买自动续订时间为一周的测试产品(沙盒模式)时,该方法应该在 3 分钟后调用,但它不会。

我做错了什么?

有人可以帮忙吗?

布尼克

Sorry for that millionth question on autorenewable subscriptions, but i don't get it.
I've done everything as describet in Apples In-App Purchase Guidelines but it didn't solve the problem.

My problem is that i have created autorenewable subscriptions but they won't be autorenewed.

I've create a Payment Transaction Observer class, which implements the SKPaymentTransactionObserver interface. This class will be installed as a paymentObserver at Application startup in the viewDidLoad: method.

PaymentTransactionObserver *observer = [[PaymentTransactionObserver alloc] init];

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

In the paymenttransactionobserver i have the paymentQueue:updateTransactions method: (same as describet in Apple's documentation)

  • (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
    for (SKPaymentTransaction *transaction in transactions) {
    switch (transaction.transactionState) {

        case SKPaymentTransactionStatePurchased: 

            [self completeTransaction:transaction]; 

            break;

        case SKPaymentTransactionStateFailed: 

            [self failedTransaction:transaction]; 

            break;

        case SKPaymentTransactionStateRestored:

            [self restoreTransaction:transaction]; 

            break;

        default:

            break;
    }
}

When i buy a autorenewable product, the product will successfully be purchase.
But it will never be autorenewed. I thought of, that the transaction observer, somehow will get deallocated, but it won't (Otherwhise, i would be notified by the debugger). I also though, i did remove the observer but it will never be removed.

I used the debugger to ensure, that the updateTranscations: method will get called, but nothing. When i buy a test product (in sandbox-mode) with autorenewal time of one week, the method should get called after 3 minutes, but it wont.

What am i doing wrong?

Can anybody help?

Br Nic

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

堇色安年 2024-12-13 22:34:37

如果订阅是自动续订的,则交易将不会通过 paymentQueue:updateTransactions 方法。更新仅在商店中进行。如果您想测试它,您必须:

  • 在应用程序服务器上重新验证收据(如果您将收据存储在那里)。

  • 在您的 iOS 客户端上重新验证收据

(http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html #//apple_ref/doc/uid/TP40008267-CH104-SW1)

为了避免每次测试自动续订启动/激活时,您应该存储订阅期的结束日期,以便随后测试续订。

另请参阅:

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html#//apple_ref/doc/uid/TP40008267-CH4-SW4

然而,沙盒中似乎存在一个错误。订阅有时会更新,有时不会。很难测试....

If a subscription is autorenewed, the transaction won't pass the paymentQueue:updateTransactions method. The renew just happens on the Store. If you want to test for it you have to either:

  • Revalidate the receipt on your application server, if you store the receipt there.

  • Revalidate the receipt on ur iOS client

(http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html#//apple_ref/doc/uid/TP40008267-CH104-SW1)

In order to avoid testing for an autorenew each launch/activation you should store the endDate of the subscription period to test for a renew afterwards.

Also see:

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html#//apple_ref/doc/uid/TP40008267-CH4-SW4

However, there seems to be a bug in the sandbox. Subscriptions sometimes get renewed, sometimes not. Hard to test....

心舞飞扬 2024-12-13 22:34:37

自动续订仅在应用程序启动时或从后台循环回来时发布到应用程序的购买队列中。尝试单击主页按钮,然后返回到您的应用程序。

Auto-renewals only get posted to your app's purchase queue on app launch or when it cycles back from being backgrounded. Try clicking the home button and then returning to your app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文