Referencing AsyncStorage crashes iOS app

I am not entirely sure that this is is a correct place to ask this question, please tell me otherwise.
I have been using ExpoKit to develop an application, which relies on usage of AsyncStorage, and everything worked nice until I wanted to deploy it to prod.

In my package.json I have:
"react-native": ""
And iOS Deployment Target is set to 10.0 for both Pods and my project.
I can provide more debugging info, if necessary, not sure what is relevant in this case.

For different reasons I would like not to use ExpoKit’s default way hosting the bundle in production app, but would still like to keep expo’s development tooling and therefore I changed the code of AppDelegate.m to this:

#import "AppDelegate.h"
#import "ExpoKit.h"
#import "EXViewController.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@interface AppDelegate ()

@property (nonatomic, strong) EXViewController *rootViewControllerExpo;


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    #ifdef DEBUG
        // Expo
        [[ExpoKit sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
        _rootViewControllerExpo = [ExpoKit sharedInstance].rootViewController;
        _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        _window.backgroundColor = [UIColor whiteColor];
        _window.rootViewController = _rootViewControllerExpo;
        [_window makeKeyAndVisible];
        // React Native
        NSURL *jsCodeLocation;
        jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
        RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
        UIViewController *rootViewController = [UIViewController new];
        rootViewController.view = rootView;
        _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        _window.backgroundColor = [UIColor whiteColor];
        _window.rootViewController = rootViewController;
        [_window makeKeyAndVisible];
        //        UIView* launchScreenView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] objectAtIndex:0];
        //        launchScreenView.frame = self.window.bounds;
        //        rootView.loadingView = launchScreenView;
    return YES;

And then my app, which was working totally fine with ExpoKit, started to crash upon opening when executing a release scheme with the following message. It works fine in debug mode when using Expo’s rootViewController

[error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'l.multiMerge')
[fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'l.multiMerge')
libc++abi.dylib: terminating with uncaught exception of type NSException

After hours of debugging I have pinpointed the minimal case which causes the crash quite consistently. Importing AsyncStorage by itself does not crash the app, but referencing it in a variable immediately causes the crash:

import React, { Component } from 'react';
import { Text, View, AsyncStorage } from 'react-native';

export default class AppContainer extends Component {
  render() {
    const bar = AsyncStorage;
    // const bar = {
    //   storage: AsyncStorage,
    // };

    return (
          flex: 1,
          justifyContent: 'center',
          alignItems: 'center',
          backgroundColor: 'yellow',

In my particular case crash is caused by using redux-persist, but it seems that the problem is wider, since when I remove initialisation of redux-persist it starts to crash somewhere in the middle of react-native-mapbox-gl. Just for reference, code of redux-persist

Googling gave me some results, but no answers:

Any help is appreciated.
Thank you.

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