作为一个附注,文件不一致的购买类型和其在收据中的持久性 - 参见
我对这个问题的回答。
当自动续订开始时,服务器端会更新收据 - 您可以通过调用服务器端的
validateReceipt
方法进行确认。
更新:看到您正在使用RMStore,我模拟了一些东西,以便我可以查看行为。
在我的情况下,客户端收据被更新。我的场景:一个月的AR订阅(因此在沙盒中每5分钟更新一次)。我在
viewDidLoad
中放置了一些诊断代码:
RMAppReceipt *receipt = [RMAppReceipt bundleReceipt];
if (receipt != nil) {
NSDateFormatter* localDateTime = [[NSDateFormatter alloc] init];
[localDateTime setTimeZone:[NSTimeZone timeZoneWithName:@"PST"]];
[localDateTime setDateFormat:@"yyyy.MM.dd HH:mm:ss zzz"];
for (RMAppReceiptIAP* purchase in receipt.inAppPurchases) {
NSString* cancellationDate = nil;
if (purchase.cancellationDate) {
cancellationDate = [localDateTime stringFromDate:purchase.cancellationDate];
}
NSLog(@"Transaction: %@: product %@, original purchase date: %@, expiration date: %@, cancellation date: %@",
purchase.originalTransactionIdentifier,
purchase.productIdentifier,
[localDateTime stringFromDate:purchase.originalPurchaseDate],
[localDateTime stringFromDate:purchase.subscriptionExpirationDate],
cancellationDate);
}
我还在RMStore的
paymentQueue:updatedTransactions:
中设置了断点,以查看队列是否更新了后续的AR购买。
然后我购买了一个月的测试产品,验证了交易,然后退出了应用程序。
在随后每5分钟重新启动应用程序时,我看到
SKPaymentTransactionObserver
方法中的断点被触发,其transactionSate为
SKPaymentTransactionStatePurchased
。日志显示购买的次数不断增加(仅显示最新版本)。
2015-05-27 14:27:32.828 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:02:59 GMT-7, expiration date: 2015.05.27 14:07:58 GMT-7, cancellation date: (null)
2015-05-27 14:27:33.350 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:06:02 GMT-7, expiration date: 2015.05.27 14:12:58 GMT-7, cancellation date: (null)
2015-05-27 14:27:33.774 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:11:07 GMT-7, expiration date: 2015.05.27 14:17:58 GMT-7, cancellation date: (null)
2015-05-27 14:27:34.174 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:16:00 GMT-7, expiration date: 2015.05.27 14:22:58 GMT-7, cancellation date: (null)
2015-05-27 14:27:34.637 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:21:04 GMT-7, expiration date: 2015.05.27 14:27:58 GMT-7, cancellation date: (null)
2015-05-27 14:27:35.069 StoreKitSandbox[5803:1054853] Transaction: 1000000156919353: product com.foo.StoreKitSandbox.1_month_autorenew_foo, original purchase date: 2015.05.27 14:26:15 GMT-7, expiration date: 2015.05.27 14:32:58 GMT-7, cancellation date: (null)
你能使用这种诊断方法来重现吗?