简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM