MKStoreKit 6.0如何检查自动续订订阅

时间:2017-04-29 16:22:24

标签: ios objective-c in-app-purchase mkstorekit

我正在使用MKStoreKit 6.1 我正在尝试检查有效订阅,这是代码:

- (BOOL) userHaveActiveSubscribe {
NSArray *myProductIds = @[oneMonthSubscribe, oneYearSubscribe, sixMonthSubscribe];
for (NSString *productId in myProductIds) {
    if([[MKStoreKit sharedKit] isProductPurchased:productId]) {
        if ([[MKStoreKit sharedKit] expiryDateForProduct:productId]) {
            if([[NSDate date] compare:[[MKStoreKit sharedKit] expiryDateForProduct:productId]] == NSOrderedAscending) {
                NSLog(@"USER HAVE ACTIVE SUBSCRIBE (%@)",productId);
                return YES;
            }
        }
    }
}
return NO;
}

但我非常担心它可能无效。如果订阅已过期,我不想让用户访问,因此如果订阅处于活动状态,我不希望限制对它们的访问。

1 个答案:

答案 0 :(得分:0)

这可能与以下错误有关:https://github.com/MugunthKumar/MKStoreKit/issues/270

只需确保在代码中正确实现了毫秒转换

相关问题