我在 Apple 文档中读到 StoreKit 不会自行恢复订阅。我需要自己处理这个问题,而不是将交易数据存储在我的服务器上。没问题,但我是否可以将此收据仅与一个 UDID(购买该收据的那个)关联起来,还是会导致我被拒绝?
如果这不是正确的方法,我将如何处理它来支持多个设备? (因为他们没有相同的UDID)
I have read in the Apple Documentation that StoreKit will not restore subscriptions on its own. I need to handle this myself instead by storing the transaction data on my server. That's fine, but am I allowed to associate this receipt with one UDID only (the one that bought it) or will this get me rejected?
If this isn't the right way to go, how would I approach this to support multiple devices? (since they don't have the same UDID)
发布评论
评论(2)
如果订阅是自动续订的,则交易将不会通过 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
使用restoreTransactions 方法,您可以获得登录Aplle-ID 的所有交易。搜索与您的产品关联的交易并验证收据以进行可能的续订。如果找不到交易,则表明用户尚未在任何设备上进行购买。
然而,沙盒中似乎存在一个错误。订阅有时会更新,有时不会。很难测试....
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
With the restoreTransactions method you get all transactions for the logged in Aplle-ID. Search for the transaction which is associated with your product and verify the receipt for possible renews. If no transaction could be found, the user has not purchased on any device.
However, there seems to be a bug in the sandbox. Subscriptions sometimes get renewed, sometimes not. Hard to test....
您不必在服务器上存储交易数据。您可以使用
-[SKPaymentQueue restoreCompletedTransactions]
启动恢复之前的购买交易。You don't have to store transaction data on your server. You can initiate a restore previous purchases transaction with
-[SKPaymentQueue restoreCompletedTransactions]
.