Hello,
Any ideas as to why the app will be receiving active entitlements even months after the subscription has expired?
Currently I have an app in production, and while going through some of the “Expired” accounts, I noticed that a few of them are still active with the application. I have checked, and double checked, tested the logic of the app and it seems as if it should block the person from using the app and being directed to a subscription page.
However, the only reasonable explanation as to why the users are still having access to the app would be if RevenueCat’s SDK is sending back an active entitlement.
I have a method, that each time the app becomes active is called, this method is in charge of verifying that the user has an active subscription each time the app becomes active.
Within “checkForActiveSubscription()” I call the “purchaserInfo” to get the latest information from the purchaser as per the instructions on how to check for active subscription on the documents.
Side note: On the documents it says to call “getPurchaserInfo()” and I think this method was renamed, but it is still showing on the documents for checking active subscriptions.
Once the “purchaserInfo” is called, if no active entitlement is found, then access is denied. Otherwise if one entitlement is active, then we inerated through the list and verify which entitlement the user has subscribed to and give them access to that level.
With this said, this logic should work, unless I am overlooking at something here.
If any Revenue Cat staff can shine a light would be great.
/// Checks if the user has an active subscription.
fileprivate func checkForActiveSubscription() {
guard !isPurchaseInProgress else { return }
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/dd/yy"
Purchases.shared.purchaserInfo { (purchaseInfo, error) in
guard let entitlements = purchaseInfo?.entitlements.active else { return }
guard !entitlements.isEmpty else { self.denyAccess(to: user) ; return } /// Denies access to the user if no entitlement is active
guard let highestEntitlement = self.getHighestRankedSubscription(entitlements: entitlements) else { return }
for (key, entitlement) in highestEntitlement where entitlement.isActive {
switch key {
case "Economy":
// Gives access to the user on this level
case "Business":
// Gives access to the user on this level
case "First Class":
// Gives access to the user on this level
default: break
}
}
}
}