One of our customers opted out of automatic renewal. She subscribed previously to a yearly subscription, and after a couple of days opted out of renewal. This means her entitlement to that yearly subscription should still be active, just the `willRenew` property of the entitlement should be false. However, the `isActive` property of the entitlement was false.
Only after asking her to restore her purchases, the entitlement was isAcgive again.
Code for checking if subscribed:
Purchases.shared.getCustomerInfo { (customerInfo, error) in
if let customerInfo = customerInfo {
if let entitlement = customerInfo.entitlements[PurchasesManager.entitlementPremium] {
if (!entitlement.isActive) {
// Not subscribed, but was subscribed?
if (premium.premiumFromAppStore) {
// Logic for ubsubscribing user and informing they're unsubscribed
}
}
}
}
}
Code for restoring purchases:
func restorePurchase() {
self.showLoaderPurchase = true
PurchasesManager.shared.restorePurchases { customerInfo, error, configured in
self.showLoaderPurchase = false
if (configured) {
if let error = error {
self.showToast("Error occured during restoring: \(error)")
} else {
let hasPremium = customerInfo?.entitlements[PurchasesManager.entitlementPremium]?.isActive ?? false
self.premium?.premiumFromAppStore = hasPremium
self.showToast(hasPremium ? "Congratulations. Successfully restored your Premium subscription" : "There are no Premium subscriptions to restore for your account")
}
} else {
self.showToast("Environment is not set up correctly. Please contact support")
}
}
}
Is this a bug with RevenueCat or App Store, or am I maybe missing something obvious here?