Skip to main content
Question

iOS Swift RevenueCat Paywall delegate methods not being called.

  • February 27, 2025
  • 4 replies
  • 20 views

Forum|alt.badge.img+4

 

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

    }

}

 

4 replies

joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 313 replies
  • March 3, 2025

Hey ​@anilkumar-devani-0e058d,

Which SDK version are you using?

Best,


Forum|alt.badge.img+4

i am using 5.16


Forum|alt.badge.img+4
joan-cardona wrote:

Hey ​@anilkumar-devani-0e058d,

Which SDK version are you using?

Best,

5.16


joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 313 replies
  • March 10, 2025

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings