Hey,
Recently I switched my unlock check from look for entitlements in `active`, to looking in `activeInCurrentEnvironment`, in order to prevent people unlocking Pro in TestFlight and carrying it over to production.
This went smoothly for them majority of users, but a couple of users have reported losing access to their Pro status, despite having active subscriptions/production lifetime purchases.
I got one user to send through a recording of his error, and the purchase flow went as follows:
- Launches app, I call `getCustomerInfo` with a policy of `notStaleCachedOrFetched`, I then pass that to a function call `handlePurchaseInfo`, which determines the user does not have any active entitlements.
- They open the Pestle Pro screen, which determines they are ineligible for a trial.
- They hit ‘Restore Purchases’, which triggers the RevenueCat restore purchases flow, and I pass the result to the same `handlePurchaseInfo` method from before. In this case, `activeInCurrentEnvironment` is empty, so I throw a `noPurchasesRestored` error, indicating to the user that no purchases were found to restore.
- Then they attempt to subscribe to the plan they know they are on, but get an App Store error, stating “You are currently subscribed to this”, with a renewal date in the future.
- After tapping ‘Ok’ to dismiss the popup, they get a ‘RevenueCat.ErrorCode 2’ error popup, indicating (I believe) a `storeProblemError`.
When I look up their data on RevenueCat, it indicates that they have an active subscription/lifetime in the production environment.
Images of functions:
This is called on attempting to purchase a package from `currentOffering`.
This is restore purchases:
And this is `handlePurchaseInfo`
The affected customers are understanding and would likely be willing to work with me on fixing the issue, but would appreciate some guidance.