Solved

Restore Purchases required after updating app version for iOS users?

  • 24 November 2021
  • 3 replies
  • 27 views

Badge

Hi everyone,

I just released a new version of my app on the App Store. When users who are already subscribed download and update to the new version, they’re getting my “Subscribe Now” paywall.

If they tap “Restore Purchases”, then it correctly restores the purchase and shows that they are now subscribed. 

My app doesn’t have user authentication, so I’m relying on RevenueCat to generate a random App User ID. This is how I’m instantiating the RevenueCat SDK:

Swift: 

// *** Configure RevenueCat in-app purchases *** //

Purchases.logLevel = .debug

Purchases.configure(withAPIKey: API_KEY_HERE, appUserID: nil, observerMode: false, userDefaults: UserDefaults(suiteName: "NAME HERE"))

Purchases.shared.delegate = self

I’m guessing what’s happening is when a user updates the app and opens it, the app instantiates the RevenueCat SDK and generates a new anonymous ID, which isn’t aliased back to the original subscription unless they tap “Restore Purchase” first.  

 

My question is--- is there any way to do this without having users tap “Restore Purchases” first?  Tapping “Restore Purchases” is not an intuitive step they would take.  If I don’t want them to have to tap “Restore Purchases” each time I update the app, would I have to add user authentication to my app?  

Or, if I don’t want to go through the trouble of user authentication, is there another way of somehow generating a random app user ID myself, storing it in User Defaults (which should be preserved between app version upgrades), and then trying to retrieve it when they launch the updated version and then instantiating RevenueCat with that retrieved app user ID? 

Basically, this is the iOS version of the question that another developer asked here.  

Thanks!

 

 

 

icon

Best answer by whuang 24 November 2021, 21:38

View original

3 replies

Userlevel 4
Badge +9

Hey @whuang!

The App User ID is already stored in User Defaults, which should persist through an app updates. The only time this would get cleared out is if .reset() or .logout() are called, or the customer uninstalls and re-installs the app.

From the configuration you shared, it looks like you’re using a custom user defaults suite name? I wonder if that may have something to do with it. You should be able to test upgrade paths in Xcode as well by increasing the version number and re-building (without uninstalling).  

Badge

Thanks @ryan!  Your advice was right on.

I did indeed add a widget in my latest app update, which required switching over to a custom UserDefaults suite following the RevCat instructions here. Because the new app version uses the custom UserDefaults suite instead of the standard one, that caused the app user ID to not persist between the app update.  

Sounds like this should only be a one time thing and that in future updates, customers will not have to tap Restore Purchases.  I also followed your advice and tried incrementing the version # in Xcode and rebuilding it without uninstalling, and the subscription status was correct upon relaunch.  

Thanks again! 

 

Userlevel 4
Badge +9

Ah yeah that would do it! Should only be a one time thing. Sorry we didn’t catch this before the release.

Reply