How to migrate `Userdefaults.standared` to a new private `UserDefaults` with custom suiteName?

  • 13 September 2022
  • 1 reply

Badge +4

As mentioned here, the workaround suggest  us to separate the `Userdefaults`.

I would like to ask how to migrate the already cached data to the new `Userdefaults`. Because once we do that when we call `Purchases.shared.getCustomerInfo` we won't get the `CustomerInfo`(data not cached in new `Userdefaults`).

1 reply

Badge +3

@Floating island Did you end up with a solution for this?

I’m thinking it’s possible to migrate like so:

for entry in UserDefaults.standard.dictionaryRepresentation() {
let (key, value) = entry

if key.starts(with: "com.revenuecat.") {, forKey: key)

Is there somebody from RevenueCat who can confirm this is a reasonable approach? Or someone in the community who has done this already?