Skip to content

Conversation

ajpallares
Copy link
Member

@ajpallares ajpallares commented Aug 5, 2025

Motivation

Using a Test Store API Key in production will result in apps being submitted to the App Store without proper in-app purchase configuration. This would lead to a broken user experience, no proceeds being made from IAPs and, very likely, to the rejection of the app. We want to ensure these builds are caught early and prevented from reaching review.

Description

This PR introduces a crash at runtime if the app is running a Release build when configuring the SDK with a Test Store API Key. Debug builds are unaffected.

Important: XCFramework support

When the SDK is distributed as an XCFramework (binary compiled with Release configuration), the client app’s DEBUG compiler flag isn’t propagated into the binary. As a result, any build—including those intended as “development” when integrated via XCFramework—will crash if a Test Store API Key is used.

This means that developing with a Test Store API key isn’t supported when adding the SDK dependency as an XCFramework.

@ajpallares ajpallares requested a review from a team August 5, 2025 09:34
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, good point, this looks good!!

Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one!

#else
// In release builds, we intentionally crash to prevent submitting an app with a Test Store API key
fatalError("[RevenueCat]: Test Store API key used in RELEASE build." +
"Please configure a valid API key before releasing.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we guide the dev a bit more? Maybe:

Suggested change
"Please configure a valid API key before releasing.")
"Please configure the App Store app on the RevenueCat dashboard and use its corresponding Apple API key before releasing.")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! yes, it's much clearer this way 👌 Thanks!!
Done in 9257137

@ajpallares ajpallares enabled auto-merge (squash) August 5, 2025 11:12
Copy link

emerge-tools bot commented Aug 5, 2025

📸 Snapshot Test

1 modified, 704 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-optimized-for-mac
0 0 0 0 235 0 N/A
RevenueCat
com.revenuecat.PaywallsTester
0 0 1 0 234 0 ✅ Approved
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-scaled-to-match-ipad
0 0 0 0 235 0 N/A

🛸 Powered by Emerge Tools

@ajpallares ajpallares merged commit 85c8534 into main Aug 5, 2025
12 checks passed
@ajpallares ajpallares deleted the test-store/crash-on-release branch August 5, 2025 11:38
github-merge-queue bot pushed a commit to RevenueCat/purchases-android that referenced this pull request Aug 5, 2025
### Description
Android equivalent of
RevenueCat/purchases-ios#5453

This PR introduces a crash at runtime if the app is running on release
(on a debuggable process) when configuring the SDK with a Test Store API
Key. Debug builds are unaffected.

---------

Co-authored-by: Antonio Pallares <ajpallares@users.noreply.github.com>
This was referenced Aug 13, 2025
tonidero added a commit to RevenueCat/purchases-android that referenced this pull request Aug 25, 2025
### Description
Android equivalent of
RevenueCat/purchases-ios#5453

This PR introduces a crash at runtime if the app is running on release
(on a debuggable process) when configuring the SDK with a Test Store API
Key. Debug builds are unaffected.

---------

Co-authored-by: Antonio Pallares <ajpallares@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants