Skip to main content

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!

 

 

 

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).  


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! 

 


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


Hey @ryan!


I am facing the same issue right now. I've created a widget whose content depends on premium status. 


Can you suggest any other solution except forcing users to restore purchases? Perhaps you have a migration solution from UserDefaults.standard to a new private UserDefaults with a custom suiteName, as suggested here 

?


Reply