Skip to content

Crash on release when using a Test Store API key#5453

Merged
ajpallares merged 5 commits into
mainfrom
test-store/crash-on-release
Aug 5, 2025
Merged

Crash on release when using a Test Store API key#5453
ajpallares merged 5 commits into
mainfrom
test-store/crash-on-release

Conversation

@ajpallares

@ajpallares ajpallares commented Aug 5, 2025

Copy link
Copy Markdown
Member

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

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

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!!

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good one!

Comment thread Sources/Purchasing/Configuration.swift Outdated
#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
Copy Markdown
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
Copy Markdown
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
@emerge-tools

emerge-tools Bot commented Aug 5, 2025

Copy link
Copy Markdown

📸 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