Skip to main content
Solved

Receiving active entitlement even the purchase is expired.

  • 23 October 2021
  • 2 replies
  • 131 views

I am receiving entitlement.isActive == true when expiration date is already long passed.

Here’s my code:

Purchases.shared.purchaserInfo { (purchaserInfo, error) in
if let error = error {
complete(.failure(error))
return
}
if let entitlement = purchaserInfo?.entitlements.alllSelf.entitleId] {
if entitlement.isActive {
UserDefaults.subscriptionCache = SubscriptionCache(isSubscribe: true, lastCheckedDate: Date())
}
complete(.success(entitlement.isActive))
} else {
complete(.failure(IAPError.noPurchasedItem))
}
}

Here’s my result:

 

The current time is 10/23 0:00 UTC

 

Please help me with this issue.

Hey @Kuang , 

It looks like this issue is being handled in Zendesk. It seems like you ran into an issue with a stale cache. The SDK will update the cache if it's older than 5 minutes, but only if you call getPurchaserInfo(), make a purchase, or restore purchases, so it's a good idea to call getPurchaserInfo() any time a user accesses premium content. You can always check the request date of your cache to see if it’s old. 


Hi Jazmine,

Thank you for the clear reply.

I’ll check to see if this is the reason.


Reply