Anton Makerov
Anton Makerov

Reputation: 1

MKStoreKit 6.0 how to check auto renewable subscriptions

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.

Upvotes: 0

Views: 500

Answers (1)

cujo30227
cujo30227

Reputation: 770

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

Upvotes: 0

Related Questions