Expo iOS13 crashes instantly on startup

Hi

It’s difficult to say for sure without proper error messages and stack traces, but there might be different causes of some of the crashes in this thread. e.g. I doubt Guided Access has anything to do with the inability to download assets.

I have seen crashes on Android where the error message is “Unexpected end of script” and I believe that’s related to incomplete downloads of the JS bundle which happens by default when the app first starts. If you’re seeing “Could not download …” for assets then maybe your users are also sometimes getting partially downloaded JS bundles. When the app starts next it will try to run the code and find it truncated, causing a crash and an “Unexpected end of script” error.

Here’s one of my posts about this on Android with a workaround that seems to have fixed it for me (although I don’t have an app on the App Store/Play Store, and hardly any users, so I can’t say for sure):

Trying to keep this open. On SDK 34, iOS 13.3.1. users on XR/XS phones reporting crashes. Phone basically makes it to splashscreen and crashes. Guided Access is not on. App runs fine on Expo.

Just had another report, we’re now up to ~10 users with the issue. It is incredibly frustrating, as my only remedy for them is “Try another device”. They are all iOS users with newer phones (typically iPhone X or newer), with updated OS’s and a freshly downloaded app. I’ve tried reproducing on our own phones with similar setups as well as multiple emulators, but with no luck.

I’ve resorted to doing a try/catch around the entire app, hoping that they would see a simple screen with some error specifics the next time we got a report, but they say that it still just crashes on the splashscreen:

import React from 'react';
import { ScrollView, StyleSheet, Text, View } from 'react-native';

import AppContainer from './src/AppContainer';
import GenericErrorBoundary from './src/components/common/GenericErrorBoundary';
import { configure } from './src/utils/sentryUtils';

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    flexGrow: 1,
    justifyContent: 'center',
    marginHorizontal: 8,
    marginTop: 100,
  },
  bottomView: { height: 150 },
});

const App: React.FC = () => {
  try {
    configure();
    return (
      <GenericErrorBoundary prefix="App root">
        <AppContainer />
      </GenericErrorBoundary>
    );
  } catch (error) {
    console.log(error);
    return (
      <ScrollView contentContainerStyle={styles.container}>
        <Text>Uh oh! App startup failed{'\n'}</Text>
        {/* eslint-disable-next-line */}
        <Text>It's not you, it's us{'\n\n'}</Text>
        <Text style={{ textAlign: 'center' }}>
          {/* eslint-disable-next-line */}
          Please contact hello@brandheroes.com with a screenshot of this error for help. We're very sorry for the
          inconvenience{'\n\n'}
        </Text>
        <Text>{`${error}`}</Text>
        <View style={styles.bottomView} />
      </ScrollView>
    );
  }
};

export default App;

The error view is comprised of simple vanilla react-native components. As far as I can tell, this confirms that the issue is not with our JS code, but with some binary integration.

Maybe it’s a key in our app.json that is not valid in some specific configuration of iOS?

{
  "expo": {
    "name": "Brandheroes",
    "description": "An app for Brandheroes",
    "slug": "brandheroes",
    "privacy": "unlisted",
    "sdkVersion": "35.0.0",
    "version": "2.3.2",
    "orientation": "portrait",
    "primaryColor": "#E1BEE7",
    "icon": "./assets/icons/android-icon.png",
    "scheme": "brandheroes",
    "assetBundlePatterns": ["assets/*"],
    "splash": {
      "image": "./assets/splash-mascot-only.png",
      "resizeMode": "cover",
      "backgroundColor": "#ffffff"
    },
    "androidStatusBar": {
      "barStyle": "dark-content",
      "backgroundColor": "#ffffff"
    },
    "extra": {
      "expoBuildNumber": "115"
    },
    "updates": {
      "fallbackToCacheTimeout": 15000
    },
    "ios": {
      "supportsTablet": false,
      "userInterfaceStyle": "automatic",
      "icon": "./assets/icons/iOS-icon.png",
      "bundleIdentifier": "com.brandheroes.ios",
      "buildNumber": "18",
      "config": {
        "usesNonExemptEncryption": false
      },
      "infoPlist": {
        "NSCameraUsageDescription": "The app needs permission to your camera in order to take photos for upload",
        "NSPhotoLibraryUsageDescription": "The app needs permission to your camera roll in order to add photos you've already taken for upload"
      }
    },
    "android": {
      "icon": "./assets/icons/android-icon.png",
      "googleServicesFile": "./google-services.json",
      "package": "com.brandheroes.android",
      "versionCode": 18,
      "permissions": ["CAMERA", "READ_EXTERNAL_STORAGE", "READ_INTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE"]
    },
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "brandheroes",
            "project": "brandheroes-app",
            "authToken": "[our auth token for Sentry]"
          }
        }
      ]
    }
  },
  "name": "brandheroes"
}

Any and all help or pointers would be very much appreciated. Besides having our users mail us their phone, I’m at a loss for where to go form here. @notbrent @esamelson - semidesparate ping :slight_smile:

As far as I can tell, it can’t be missing config keys or other undefineds as was the case for @t3rminus, as the app works fine for the vast majority of users, new and existing.

Is there any way for me to detect whether the issue is with a partial asset download, or for a partial app bundle download? I still suspect this might be it. I’m wondering why we get all these ‘cannot download asset from [cloudfront URL]’ errors, seeing as those assets should be bundled with the binary according to the docs?

For example, our icon for home, and a bunch of others: https://d1wp6m56sqw74a.cloudfront.net/~assets/f90d024e8baa4b45f16a14cf18a59ff9

can you create an issue on Issues · expo/expo · GitHub? thanks

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