Expo client crashes instantly on open on iOS with Segment.initialize()

#1

Anyone had issues with the Segment API on iOS? The Expo app is instant crashing when I initialize Segment. The device log says:

com.apple.CoreSimulator.SimDevice.6A0A1897-66B0-45E7-8FB7-AC4F562404F5[6053] (com.apple.WebKit.Networking.01C31F32-FA1E-455E-8F8E-D876B7B68DAB[6176]): Service exited with abnormal code: 1

Everything works fine on Android. Tried on different simulators, and on physical device as well. Using SDK 24.

Code is super simple. AppContainer:

class AppContainer extends React.Component<IAppContainerProps, IState> {
 
  componentWillMount() {
    Analytics.initialize();
}

The Analytics class:

import { Segment } from 'expo';

export class Analytics {
  /**
   * Initialization of the library
   */
  public static initialize = () => {
    const config = getConfig();
    const { androidWriteKey, iOSWriteKey } = config.segment;
    Segment.initialize({ androidWriteKey, iOSWriteKey });
  }
 
}

Reproducible snack: https://snack.expo.io/H19fhhLFz - You need to insert own keys for Segment, though. The app crashes on the iOS snack simulator, too, but works on Android.

Any ideas how to move forward? A fix would be awesome, and a workaround would be much appreciated :smiley:

0 Likes

#2

So it seems that the params to initialize are very case specific, so the iOSWriteKey should instead be iosWriteKey.

Github issue: https://github.com/expo/expo/issues/1535

1 Like

closed #3

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

0 Likes