Solved

Receiving active entitlement even the purchase is expired.

  • 23 October 2021
  • 2 replies
  • 125 views

Badge +3

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.all[Self.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.

icon

Best answer by jazmine 5 November 2021, 18:20

View original

2 replies

Userlevel 3
Badge +7

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. 

Badge +3

Hi Jazmine,

Thank you for the clear reply.

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

Reply