Objective c MKStoreKit自动恢复订阅
我正在使用MKStoreKit处理自动恢复订阅。我目前正在测试一个1个月的订阅(在测试中,订阅持续5分钟)。购买订阅后,我会等待它过期。一旦到期,我会检查订阅是否仍然有效Objective c MKStoreKit自动恢复订阅,objective-c,ios,in-app-purchase,mkstorekit,Objective C,Ios,In App Purchase,Mkstorekit,我正在使用MKStoreKit处理自动恢复订阅。我目前正在测试一个1个月的订阅(在测试中,订阅持续5分钟)。购买订阅后,我会等待它过期。一旦到期,我会检查订阅是否仍然有效 [[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier] 这会像我预期的那样返回false。然而,由于它是自动续费的,我希望届时MKStoreKit会联系苹果公司重新验证订阅。也许我用错了MKStoreKit,但根
[[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier]
这会像我预期的那样返回false。然而,由于它是自动续费的,我希望届时MKStoreKit会联系苹果公司重新验证订阅。也许我用错了MKStoreKit,但根据和,它应该简单到:
//App Delegate
[MKStoreManager sharedManager];
//lets me know when the subscription was purchased
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subscriptionPurchased:) name:kSubscriptionsPurchasedNotification object:nil];
//lets me know when the subscription expires
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subscriptionFailed:) name:kSubscriptionsInvalidNotification object:nil];
//In a view with subscription feature
if([[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier]){
//access to subscription feature
}
//Where the user would purchase the subscription
[[MKStoreManager sharedManager] buyFeature:subscriptionId onComplete:^(NSString* purchasedFeature, NSData* receiptData)
{
...
}
onCancelled:^
{
...
}
我的问题是,为什么当苹果端的订阅仍然活跃时,MKStoreKit不让我知道呢?上面说:
为了进行测试,在生产环境和测试环境中自动更新订阅之间的行为存在一些差异
续费速度加快,自动续费订阅每天最多续费六次。这可以让您测试应用程序如何处理订阅续订,以及它如何处理过期后的续订,以及它如何处理包含间隙的订阅历史记录
由于到期和续订速度加快,订阅可能会在系统开始尝试续订订阅之前过期,从而在订阅期内留下一小段时间间隔。由于各种原因,生产中也可能出现此类失误。请确保应用程序正确处理这些失误。
你能试着: