Question

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

  • 9 October 2023
  • 1 reply
  • 24 views

Badge +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?


1 reply

Badge +1

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.

Reply