Learn Courses My Dashboard

RevenueCat - after subscription cancelation, App still runs unrestricted

Hello fellow developers. I Could use some advise with the subscriptions and RevenueCat.
After following the amazing videos of Chris about RevenueCat and subscriptions, I made a test App and it runs great.
The only thing I notice is, after canceling my subscription on Sandbox, the App still runs unrestricted AS LONG as you don’t shut it down, restart it, restart your phone etc…
What can we do in order for the App to become restricted again, as soon as you cancel the subscription?
PS: I know you are still entitled to access the App’s content as long as you’re still within the previously subscribed period. But I’m testing the monthly period (with 1 week free trial) and even though I cancel it straight away, the App still runs unrestricted.
Any thoughts?

Welcome to the community!

I haven’t used RevenueCat yet, but I would think you’d have to add code that goes back and “turns off” access to premium features in your app

It was added. I did exactly what Chris did on the videos.
I don’t know if it’s a simulation thing or if it will actually happen once it’s online.
Because I also noticed that if you leave the subscription ON, the subscription will end after 5 re-subscriptions regardless.
So i’m a bit confused with the simulation

I’d recommend seeing if the problem still occurs on an actual iPhone versus in the Simulator. Also, what’s the code that triggers the end of the subscription? Do you have it call out once an hour to check, if it has a valid license? Or every time the user returns to a specific page in the app? You could even have it check for the subscription as soon as the app goes into the background.

I also don’t have experience working with RevenueCat but what you described is achievable if RevenueCat have support for push notification or silent push notification mechanism that notify the app for any changes on the app subscription status. I suggest you check their API Docs for more info.

I’m running it on an actual iPhone.
It’s on viewWillAppear. How would I write it, so that it will check it every hour?

But again, I’m not sure about this whole thing, because regardless of cancelling the subscription or not, the App will run (auto-subscribe for 5 x and then cancel itself)

This 5 times auto-subscribing thing was when the iOS didn’t have a way of cancelling the subscriptions on Sandbox. But now it does, and yet, the behavior is the same as before.
I’m kinda lost. I don’t want to upload a new version of my app with a faulty subscription plan.

override func viewWillAppear(_ animated: Bool) {

    //Check entitlement and show Pro Content
    Purchases.shared.purchaserInfo { (purchaserInfo, error) in
        if purchaserInfo?.entitlements.all["pro"]?.isActive == true {
            // User is "Pro"

            //Create a label for the content
            self.labelUnlocked.isHidden = false
            self.showFeatures()
            
        }
        else {
            self.hideFeatures()
        }
    }
}