Skip to main content
Question

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


Forum|alt.badge.img+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

Forum|alt.badge.img+1
  • Author
  • New Member
  • 1 reply
  • March 11, 2023

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


Forum|alt.badge.img+7
  • Dedicated Contributor
  • 62 replies
  • March 14, 2023

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings