Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribution sync doesn't happen unless the user open again the app #4074

Closed
9 of 12 tasks
jesus-mg-ios opened this issue Jul 17, 2024 · 3 comments
Closed
9 of 12 tasks
Labels

Comments

@jesus-mg-ios
Copy link

Describe the bug
We are seeing that going to background does not update the attributes with revenuecat and also if you make a purchase the purchases are updated on the revenuecat dashboard but not the attributes. The workaround for now it's calling to syncAtttributesAndOfferings when the app is become active or when the purchase is done.

  1. Environment
    1. Platform: iOS
    2. SDK version: 4.41.2
    3. StoreKit version:
      • StoreKit 1
      • StoreKit 2 (enabled with usesStoreKit2IfAvailable(true))
    4. OS version: 17.5
    5. Xcode version: 15.2
    6. Device and/or simulator:
      • Device
      • Simulator
    7. Environment:
      • Sandbox
      • TestFight
      • Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will help us debug this issue.

Even doing the sync the console log these warns:

ERROR: 😿‼️ Error when syncing subscriber attributes. Details: The operation couldn’t be completed. (RevenueCat.BackendError error 0.) 
UserInfo: [:]
ERROR: 😿‼️ One or more of the attributes sent could not be saved. ["$mediaSource": "Media source cannot be modified."]

I can assure that media source is only set once, and the backend error well, I don't know why it's happening.

@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@kmurphy-rc
Copy link

Hey @jesus-mg-ios!
This looks expected - once attribution data is set for a subscriber, it can't be changed. This way attribution data can be associated with the original installation without getting overwritten. The error that you are seeing: "Media source cannot be modified." is letting you know that this attribute already exists for the user, so it's not preventing you from setting attributes but from modifying the previously set attribute any further. This applies to device identifiers as well. You can read more about this in our documentation here: https://www.revenuecat.com/docs/customers/customer-attributes#reserved-attributes

@jesus-mg-ios
Copy link
Author

Thank you for your response, @kmurphy-rc. Perhaps I wasn't clear enough. It seems like RevenueCat might be removing attributes at certain points. I was thinking about the method mentioned here, specifically when and where it is called, and if it might be causing issues related to data races.

For example, if the data is being cleaned while another thread is still writing a new user ID, the old user ID might be written by mistake. Creating an actor to manage all read and write operations could potentially solve this hypothetical data race problem. Currently, the workaround is to force a sync, which results in the error you pointed out.

However, I've noticed that RevenueCat does not always sync attributes when the app is backgrounded or when a purchase is made. Syncing happens sporadically, and most of the time, without forcing a sync, it does not occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants