Question

When the device is not connected to the internet, how can I get the last fetched ‘offerings’ data?

  • 31 January 2023
  • 3 replies
  • 145 views

Badge +2

My project is written in objective-c and I am using the following method to fetch data: 

[[RCPurchases sharedPurchases] getOfferingsWithCompletion:^(RCOfferings *offerings, NSError *error) {}

When the device is out of network, this method doesn’t get any data, which is logical as there is no internet connection. But the device already fetched this data earlier. How can I read this data? I can save the fetched data manually, but I found that RevenueCat has the mechanism to cache the data, but couldn’t find a way/thread to read this data in the forum. It would be a great help if there is an easy way to read the fetched data offline.


3 replies

Userlevel 5
Badge +9

Hey @Sumon Ahmed!

Not caching Offerings between app launches is intentional, as you don’t want to display out-of-date pricing information to customers. Also, a network connection is required to complete a purchase through Apple so you can warn the customer of this at when or before you attempt to present your paywall. 

Badge +2

Hey Ryan, thanks for your answer.

“as you don’t want to display out-of-date pricing information to customers.”

 

I am thinking about what should I show in the paywall screen 🤔. 

I am working with some kids' app and nowadays, so many parents want their kids will use their iPhones/iPad offline. Tapping a locked item and showing the paywall screen with pricing is important to convince the parents to upgrade to premium even with old price. Network connection is checked after successful parental access. I have to manually cache the last offerings data, otherwise I need to show the paywall screen without pricing which is not a good idea i think. 

 

“Not caching Offerings between app launches is intentional.”

 

For my scenario, caching Offerings between app launches would be a great help. 🙁

Userlevel 5
Badge +9

Hey @Sumon Ahmed you could save the Offerings in UserDefaults and update it each time the `getOfferings` call completes. You’d probably also want to save a timestamp or something so you could throw out the cache and just wait for the network if it’s too stale. 

Reply