Question

iOS RevenueCat SDK returns Anonymous ID after successful purchase and login(Sandbox)

  • 11 March 2023
  • 2 replies
  • 36 views

Badge +1

RevenueCat returns an AnonymousID for originalAppUserId instead of the UUID I send it. After the purchase I login to RC with the UUID(RC returns an anonymous ID). Also, at startup after logging in with the UUID in didFinishLaunchingWithOptions, RC returns the same anon ID in the purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) callback.

This has a material impact on the use of my multi-user app since I depend on the uuid userId to determine many aspects of the app state.

How can I ensure that RC returns the user ID that I gave it?

Here’s how I initialize RC at startup in didFinishLaunchingWithOptions:

 

let configuration = Configuration.Builder(withAPIKey: "asdf")

          .with(appUserID: currentClientUser.id)

          .with(usesStoreKit2IfAvailable: false)

          .build()

Purchases.configure(with: configuration)

Purchases.shared.logIn(currentClientUser.id) { (customerInfo, created, error) in

                os_log("Purchases.shared.logIn customerInfo: %@", log: OSLog.data, String(describing: customerInfo))

                os_log("Purchases.shared.logIn created: %@", log: OSLog.data, String(describing: created))

                os_log("Purchases.shared.logIn error: %@", log: OSLog.data, String(describing: error))

            }

 

RevenueCat SDK: 4.17.7

Xcode 14.2

iPad OS 16.2

 


2 replies

Userlevel 3
Badge +7

That could do it. Let us know if you didn’t get this solved. Configuring with a custom App User ID should cause the SDK to return that same ID unless logged out, or login is called again with a different user.

Badge +1

I believe I know what could be wrong. I was calling logOut() in a couple places.

Reply