Skip to main content

 

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")

    }

}

 

Hey ​@anilkumar-devani-0e058d,

Which SDK version are you using?

Best,


i am using 5.16


Hey ​@anilkumar-devani-0e058d,

Which SDK version are you using?

Best,

5.16


Hi ​@anilkumar-devani-0e058d,

Upgrading to the latest SDK version should fix the issue, we had a bug around those delegate methods that’s already been fixed and released. Can you try testing it and letting me know if that works?

Best,


Reply