EAS Build] AsyncStorage and SecureStore Data Empty After Updating From a Classic Built App (SDK 45) to an EAS Built App (SDK 47)

Summary

I currently have a production build of an iOS app in the app store using SDK 45 built using the Classic Build Method. Recently I updated to SDK 47 to take advantage of EAS Build.

After upgrading the app to SDK 47 and building using EAS Build I published my app to TestFlight for internal testing. However, the user data from AsyncStorage and SecureStore does not transfer between the versions. The EAS built app no longer has any access to the previous information stored in AsyncStorage and SecureStore.

Building the app with Classic Build method and publishing it to TestFlight retains the user data.

Things I Tried

I originally though it had something to do with the iOS Entitlements, as the keychain-access-groups was missing from the iOS entitlements. Adding keychain-access-groups in the app.json did not solve the issue.

"entitlements": {
        "keychain-access-groups": ["XXXXXXXX.*", "com.apple.token"]
      } 

Discussion

Could this issue still be a factor of how the entitlements are structured between the build methods. I noticed a discrepancy between the entitlements group when building the app with Classic and EAS methods. In the example below we can see that the Classic Build entitlements group is “ExpoKitApp.app/CaMyAppTest” (which is my Bundler Identifier). However, in the EAS build the entitlements group is MyApp.app/MyApp (which is the slug/name of my app).



Similar Issues

This issue is not new I have found other users having the same issue.

What platform(s) does this occur on?

iOS

SDK Version

47

Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: Windows 10 10.0.22000
    Binaries:
      Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
      npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      expo: ^47.0.0 => 47.0.8
      metro: ^0.73.4 => 0.73.4
      react: 18.1.0 => 18.1.0
      react-dom: 18.1.0 => 18.1.0
      react-native: 0.70.5 => 0.70.5
      react-native-web: ~0.18.7 => 0.18.10
      react-navigation: ^4.4.4 => 4.4.4
    Expo Workflow: managed

Minimal reproducible example

  1. Create a new app that uses AsyncStorage and SecureStore on SDK <47 e.i. SDK 45
  2. Build the application using expo build (Classic Build)
  3. Publish the application to TestFlight and install it on a device
  4. Store something to AsyncStorage and SecureStore in the app
  5. Update app to use SDK 47
  6. Build the application again with eas build
  7. Publish the application to TestFlight and update the app on the device to the new version
  8. Try to get the information stored in previous version, it returns null
  9. Downgrade app to use SDK <47 e.i. SDK 45
  10. Try to get the information stored in, it returns null

hi! have you figured this out? thanks!

This issue is pretty old. There was a time (can’t remember off hand what the Expo SDK versions were, but definitely a lot older than SDK 45) when the default location for AsyncStorage was moved or something like that, so the original issue might have been related to that.

So it might be worth creating a new issue with your reproduction example.

In my case is SDK45 expo build to SDK45 eas build.

I will endup publishing an OTA update that will move the sectureStore to the store an then, with the new eas built app, move it back to the secureStore.

Thanks!

It appears that adding the following wildcarded entitlements keychain-access-groups in the app.json did solve the issue. (XXXXXXXX should be your Team ID)

"ios": {
	"entitlements": {
        "keychain-access-groups": ["XXXXXXXX.*", "com.apple.token"]
      } 
}

We made a discovery that by doing a fresh uninstall of the classic built app and then going from the classic built straight to the EAS build with manually set entitlements the app data persisted.

I am still unsure why the keychain-access-groups were removed in the EAS build.