iOS crash on load, android works perfectly

#1

First things first, thanks for creating Expo! It feels like magic, every day I’m using it :slight_smile:

I converted my vanilla React Native project to Expo with the exp command line, and that worked wonderfully.
It’s running on the android simulator and on my physical android device. However it crashes immediately on loading on the iOS simulator and a physical iPhone device. My question is, where can i find some error logging for this ?
I’m not able to enable the remote debugging because of the immediate crashing of the app on load.

Thanks!

#2

Hi, usually when there is an iOS native crash, it’s because you are passing the wrong type for a prop. It’s performance-prohibitive for iOS to validate all types coming over the bridge from JS to native. Is there some circumstance in one of your Views where you are passing, for example, a dictionary instead of a number, or vice versa?

If you view the device logs (as detailed here) you may be able to get more info about the native crash when it happens.

#3

I will look into this! Thanks for the fast reply! <3

Expo hangs waiting for a promise on Android and iPhone, but not in remote debug mode
#4

*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’

I guess this might be the issue, I’ll look into the wrong type props issue.

#5

Ok fixed it! There was a problem with aSyncStorage on the first launch of the iOS app there was no key to be fetched so i guess it crashed.

// Get the saved favorite artists from the device storage
// And dispatch to redux store
export const setInitialStateFromAsyncstorage = () => {
  return dispatch => {
    asyncStore
      .get('favoriteArtists')
      .then(favoriteArtists => {
        dispatch(pushToRedux(favoriteArtists.favorites));
      })
      .catch(error => {
        console.log('oops, i fucked up right here.', error);
        // Set an initial empty object for this key, this should prevent iOS
        // app from crashing on launch. This initial save below fixed it.
        asyncStore.save('favoriteArtists', {
          favorites: {},
        });
      });
  };
}