"Switch must be exhaustive" warning, missing .unsupported cases
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.
- Environment
- Platform:
- SDK version:
- 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)
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
- OS version:
- Xcode version: 16.4
- Device and/or simulator:
- [x] Device
- [x] Simulator
- Environment:
- [x] Sandbox
- [x] TestFlight
- [x] Production
- How widespread is the issue. Percentage of devices affected.
- Debug logs
Switch must be exhaustive
-
Steps to reproduce The compiler expects all enum cases to be explicitly handled, even with
@unknowndefault. -
Other information May require replacing
@unknowndefault -
Additional context Likely surfaced by stricter checks in recent Xcode versions or SDK updates.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
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.
Yes, this is using the most recent SDK version. And yes, it does compile as these are only warnings in Xcode (currently).
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.
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
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