Description:
-
Expected Behavior
When building the application using a modern Xcode version (which bundles the necessary SDKs for new StoreKit 2 / Commitment features), the code inside the conditional blocks should be compiled and executed properly, regardless of whether the host project targets an older Swift Language Mode for backward compatibility.
-
Actual Behavior
The code inside the conditional block is completely stripped out / ignored at build time, leading to a silent failure during runtime (parameters like pricingTerms or billingPlanType return as null/missing).
This happens because the library uses #if swift(>=6.3) (or similar high version) to guard the code. If the main host application sets Swift Language Version = 5.9 in Xcode Build Settings to keep older dependencies stable, this condition evaluates to FALSE, forcing the compiler to ignore the block entirely—even though the Xcode toolchain itself is fully capable of compiling it.
- Root Cause
#if swift(>=X.X) checks the Swift Language Mode specified in the target's Build Settings (which is 5.9 in our case).
#if compiler(>=X.X) checks the actual capability of the compiler toolchain bundled with Xcode.
Using #if swift instead of #if compiler mistakenly locks out modern SDK features from being compiled just because the project maintains backward compatibility via language mode.
- Steps to Reproduce
Use a modern Xcode version (e.g., Xcode 16+ / Xcode 26.5+).
Set the main project's Swift Language Version to 5.9 in Build Settings.
Fetch a product that contains the new 12-month commitment / billing plan layout.
Notice that the properties are missing/null, and initiating a purchase results in a silent failure because the underlying native implementation was stripped out during the build.
- Suggested Fix
Replace #if swift(>=...) with #if compiler(>=...) to check for toolchain/SDK availability rather than forcing the project's language mode to upgrade.
Before:
Swift
#if swift(>=6.3)
if #available(iOS 16.4, *) {
let plan = product.billingPlanType
}
#endif
After:
Swift
#if compiler(>=6.3)
if #available(iOS 16.4, *) {
let plan = product.billingPlanType
}
#endif
Description:
Expected Behavior
When building the application using a modern Xcode version (which bundles the necessary SDKs for new StoreKit 2 / Commitment features), the code inside the conditional blocks should be compiled and executed properly, regardless of whether the host project targets an older Swift Language Mode for backward compatibility.
Actual Behavior
The code inside the conditional block is completely stripped out / ignored at build time, leading to a silent failure during runtime (parameters like pricingTerms or billingPlanType return as null/missing).
This happens because the library uses #if swift(>=6.3) (or similar high version) to guard the code. If the main host application sets Swift Language Version = 5.9 in Xcode Build Settings to keep older dependencies stable, this condition evaluates to FALSE, forcing the compiler to ignore the block entirely—even though the Xcode toolchain itself is fully capable of compiling it.
#if swift(>=X.X) checks the Swift Language Mode specified in the target's Build Settings (which is 5.9 in our case).
#if compiler(>=X.X) checks the actual capability of the compiler toolchain bundled with Xcode.
Using #if swift instead of #if compiler mistakenly locks out modern SDK features from being compiled just because the project maintains backward compatibility via language mode.
Use a modern Xcode version (e.g., Xcode 16+ / Xcode 26.5+).
Set the main project's Swift Language Version to 5.9 in Build Settings.
Fetch a product that contains the new 12-month commitment / billing plan layout.
Notice that the properties are missing/null, and initiating a purchase results in a silent failure because the underlying native implementation was stripped out during the build.
Replace #if swift(>=...) with #if compiler(>=...) to check for toolchain/SDK availability rather than forcing the project's language mode to upgrade.
Before:
Swift
After:
Swift