purchases-ios icon indicating copy to clipboard operation
purchases-ios copied to clipboard

Cannot get the active entitlements in `Sandbox` environment when having same type of entitlements in `Prod`.

Open menghaozhang opened this issue 1 year ago • 3 comments

Describe the bug The user data in prod environment will override the sandbox environment for active entitlements. I have same entitlements type(not exactly same as different expire dates.) in both prod and sandbox env when using customerInfo?.entitlements.activeInAnyEnvironment I can only get the prod env active entitlements. Which is fine. But when using customerInfo?.entitlements.activeInCurrentEnvironment I get no active entitlements no, as empty.

  1. Environment
    1. Platform: iOS
    2. SDK version: 4.32.0
    3. StoreKit version:
      • [x] StoreKit 1
      • [ ] StoreKit 2 (enabled with usesStoreKit2IfAvailable(true))
    4. OS version: 17.0
    5. Xcode version: 15.x
    6. Device and/or simulator:
      • [X] Device
      • [X] Simulator
    7. Environment:
      • [X] Sandbox
      • [ ] TestFight
      • [ ] Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will help us debug this issue.
Logs here
  1. Steps to reproduce, with a description of expected vs. actual behavior
  • Create a user with same type of active entitlement in both prod and sandbox env.
  • Use customerInfo?.entitlements.activeInCurrentEnvironment to fetch the data.

Expected behavior

  • Client should get expected data same as shown in console in corresponding environment.

Actual behavior

  • In sandbox env, the result is empty.
  • In prod env, the result is correct.
  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.) If I "remove" the active entitlement from prod env user(either transfer to another user or delete it), I can get correct active entitlement in sandbox env.

  2. Additional context

menghaozhang avatar Jan 22 '24 12:01 menghaozhang