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

iOS Swift RevenueCat Paywall delegate methods not being called. #4836

Open
anil72178 opened this issue Feb 28, 2025 · 1 comment
Open

iOS Swift RevenueCat Paywall delegate methods not being called. #4836

anil72178 opened this issue Feb 28, 2025 · 1 comment
Labels

Comments

@anil72178
Copy link

anil72178 commented Feb 28, 2025

I have the following code, but only the paywallViewControllerWasDismissed method is being called. Other PaywallViewControllerDelegate methods are not triggered. Any solution for this?

import Foundation
import RevenueCatUI
import RevenueCat
import UIKit

class RevenueCatManager: NSObject {

static let shared = RevenueCatManager()

private override init() {}

func presentPaywall(from viewController: UIViewController, offeringID: String) {

    Purchases.shared.getOfferings { (offerings, error) in

        guard let offering = offerings?.offering(identifier: offeringID) else {

            print("⚠️ Error fetching offering with ID: \(offeringID) - \(error?.localizedDescription ?? "Unknown error")")

            return

        }

        DispatchQueue.main.async {

            let paywallVC = PaywallViewController(offering: offering)

            paywallVC.delegate = self

            paywallVC.modalPresentationStyle = .fullScreen

            viewController.present(paywallVC, animated: true)

        }

    }

}

}

extension RevenueCatManager: PaywallViewControllerDelegate {

func paywallViewController(_ controller: PaywallViewController, didFinishPurchasingWith customerInfo: CustomerInfo) {

    print("✅ Purchase successful: \(customerInfo)")

}

func paywallViewControllerWasDismissed(_ controller: PaywallViewController) {

    print("❌ Paywall was dismissed")

}

func paywallViewControllerDidStartPurchase(_ controller: PaywallViewController) {

    print("⏳ Purchase process started")

}

func paywallViewControllerDidCancelPurchase(_ controller: PaywallViewController) {

    print("⚠️ Purchase was canceled")

}

}

@anil72178 anil72178 added the bug label Feb 28, 2025
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

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

No branches or pull requests

2 participants