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

"Switch must be exhaustive" warning, missing .unsupported cases

Open neave opened this issue 6 months ago • 3 comments

Describe the bug Xcode shows “Switch must be exhaustive” in PurchasesError.swift getStoreKitErrorInfoIfAny and StoreKitError+Extensions.swift, even though @unknown default is present. They need the '.unsupported' case.

  1. Environment
    1. Platform:
    2. SDK version:
    3. StoreKit version:
      • [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with .with(storeKitVersion: .storeKit1))
      • [x] StoreKit 2 (default on versions >=5.0.0)
    4. OS version:
    5. Xcode version: 16.4
    6. Device and/or simulator:
      • [x] Device
      • [x] Simulator
    7. Environment:
      • [x] Sandbox
      • [x] TestFlight
      • [x] Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs
Switch must be exhaustive
  1. Steps to reproduce The compiler expects all enum cases to be explicitly handled, even with @unknown default.

  2. Other information May require replacing @unknown default

  3. Additional context Likely surfaced by stricter checks in recent Xcode versions or SDK updates.

neave avatar Jun 20 '25 11:06 neave

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Jun 20 '25 11:06 RCGitBot

Hi, thanks for reporting this, we will take a look. Can you make sure that you are on our most recent SDK version 5.29.0 if you aren't already? Note that as this is a warning you should be able to still run your app and make purchases but let me know if this isn't the case.

HaleyRevcat avatar Jun 24 '25 15:06 HaleyRevcat

Yes, this is using the most recent SDK version. And yes, it does compile as these are only warnings in Xcode (currently).

neave avatar Jun 24 '25 21:06 neave

Hello, just checked with the latest XCode (26 RC1) and the latest Revenuecat 5.38.1, and this is still happening. It does compile, but warnings are adding a bit of noise, so a fix would be appreciated.

Image

marcgg avatar Sep 10 '25 14:09 marcgg

Hi folks, apologies for the delay on this. We've just merged https://github.com/RevenueCat/purchases-ios/pull/5589, which addresses these warnings. It'll be included in the next SDK release this week, so these warnings should be resolved shortly.

I'll update this issue when the next release is out and close the issue then. Thanks!

  • Will

fire-at-will avatar Sep 23 '25 14:09 fire-at-will

Hi folks, PR https://github.com/RevenueCat/purchases-ios/pull/5589 containing the fix has been released in SDK version 5.40.0. Upgrading your SDK to this version should resolve the warnings.

I'm going to close out this issue for now, but feel free to re-open it and tag me if you see these warnings persist or reappear after upgrading to SDK version 5.40.0.

Thanks!

  • Will

fire-at-will avatar Sep 25 '25 14:09 fire-at-will