Saturday, July 13, 2024
HomeiOS Developmentios - RevenueCat - Checking subscription standing all the time returns lively...

ios – RevenueCat – Checking subscription standing all the time returns lively subscription


If a person has subscribed to the app however then unsubscribed, the next code nonetheless executes `subscribe()’ with options remaining unlocked.

func verifyIAPReceipt() {
    
    Purchases.shared.invalidateCustomerInfoCache()
   
    Purchases.shared.getCustomerInfo { (customerInfo, error) in
        if error == nil {
            if let customerInfo = customerInfo {
                
                if !customerInfo.entitlements.lively.isEmpty {
                    
                    print("ENTITLEMENTS IS EMPTY") <-- This isn't executed

                    self.unsubscribe()

                } else {
                        
                        print("ENTITLEMENTS IS NOT EMPTY") <-- Executed

                              
                    if customerInfo.activeSubscriptions.isEmpty == false {
                        print("Energetic Subscriptions is NOT empty") <-- Executed
                        
                        for s in customerInfo.activeSubscriptions  {
                            if s == "com.app.come.promonthly" || s == "com.app.com.proyearly"  {
                                subscribe() <-- Executed Unlocks options
                            } 
                        }
                    } else if customerInfo.activeSubscriptions.isEmpty == true {
                        print("Energetic Subscriptions are empty")
                        self.unsubscribe()
                    } else {
                        print("Energetic Subscription and profile is subscribed")
                    }
                }
                
            }
            
            
        } else {
            print("ERROR GETTING CUSTOMER INFO TO VERIFY RECEIPTS")
        }
    }
}

I’ve additionally tried eradicating cached data with

    Purchases.shared.invalidateCustomerInfoCache()

Additionally when opening Debug > StoreKit, not transactions are present.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments