Skip to main content
Question

After Implementation of RevenueCat I cant reach any static variables from my mainViewController?

  • October 9, 2023
  • 1 reply
  • 32 views

Forum|alt.badge.img+1

After I implement RevenueCat with Swift Package Manager, everything works fine till user verification process. I create a checkStatus function:

 

class SettingsController: UIViewController {

static var subscriptionStatus = false

 

Purchases.shared.getCustomerInfo {(customerInfo, error) in

            if let error = error {

                print("Get Customer Status Error: \(error.localizedDescription)")

            } else {

                if customerInfo?.entitlements[RevenueCatAPI.entitlementID]?.isActive == true {

                    DispatchQueue.main.async {

                        SettingsController.subscriptionStatus = true

                        print(SettingsController.subscriptionStatus)

                    }

                } else {

                    DispatchQueue.main.async {

                        SettingsController.subscriptionStatus = false

                        print(SettingsController.subscriptionStatus)

                    }

                }

            }

        }

I need to reach that subscriptionStatus result from my mainViewController but it is imposible now. Before the implemantation I use lots of static variable any they still work and reachable but when I delete them I can’t add them again… Please Help Me?

This post has been closed for comments

1 reply

Forum|alt.badge.img+1
  • Author
  • New Member
  • 1 reply
  • October 10, 2023

Sometimes XCODE 15 frezing and not let you to call static variables from that page. You should restart the XCODE then if it is not work you have to close all the ViewController.swift page one by one. After that everything will be fixed.


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