Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround for failed payments on iOS 18.2 #4610

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MarkVillacampa
Copy link
Member

@MarkVillacampa MarkVillacampa commented Dec 18, 2024

There's a bug introduced by Apple in iOS 18.2 which prevents the payment sheet from being displayed if the current scene's key window root view controller is not part of the view hierarchy.

This can happen if it is currently presenting a modal view controller with modalPresentationStyle = .fullScreen.

When the issue manifests, there is a log error message printed in the console: Could not get confirmation scene ID for

To workaround the issue we traverse the view controller hierarchy until we find the topmost one and present the payment sheet there with the new purchase() method introduced in iOS 18.2 which accepts a UIViewController.

IMPORTANT: The fix requires compiling with Xcode 16.2 to take effect.

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Description

@MarkVillacampa MarkVillacampa added the pr:fix A bug fix label Dec 18, 2024
@fire-at-will
Copy link
Contributor

@RCGitBot please test

@tasfiliz
Copy link

Tested it in our app's sandbox, and it’s working perfectly. ✅ Great work RevenueCat team @MarkVillacampa @fire-at-will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants