MKStoreKit 6.0 how to check auto renewable subscriptions

495 views Asked by At

I am using MKStoreKit 6.1 I am trying to check the active subscription, here is the code:

- (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;
}

But I'm very worried that it might not work. I would not like to give users access if the subscription has expired, so I would not want to restrict access to them if the subscription is active.

1

There are 1 answers

0
cujo30227 On

This is probably related to this bug: https://github.com/MugunthKumar/MKStoreKit/issues/270

Just ensure that the conversion to milliseconds is correctly implemented in the code