AsyncStorage (UserDefaults) returns null when switching Expo accounts on the same app

We switched to a new Expo account for our Expo 32 standalone app and confirmed that upgrading an Expo standalone app from a different account clears out (or cannot access) the previous UserDefaults properties. We observed this both in iOS and Android. (I previously did not observe in Android because we actually didn’t build the app update on the new account for that platform)

Steps to reproduce in dev:

  • expo start
  • Set user data, reload app to verify local storage data was saved.
  • Close out expo
  • expo login different account
  • expo start -c
  • AsyncStorage returns null

Steps to reproduce on standalone:

  • Build standalone app with an Expo account with -t simulator
    AsyncStorage and SecureStorage Test - Snack
  • Install on your Simulator phone.
  • Close and reopen app to verify local storage data was saved.
  • Switch Expo accounts and rebuild the same repo with -t simulator
  • Install/overwrite the Simulator app.
  • Open app, the user defaults return null.

Original message: We just upgraded to Expo 32 for our standalone iOS app and switched Expo accounts, and believe some users did not get their UserDefaults persisting when the App Store did an update on their phone.

Other possible points of failure:

  • We save user data to the namespace of user_info without an @ symbol AsyncStorage.setItem('user_info'); Maybe Expo 32 changed this?
  • We use if (__DEV__) to determine if we want to clear data with removeItem.

Does not occur with SecureStore on iOS! So we will switch to that.

1 Like

Thanks for the report and update @ericjames!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.