1

I got this error when i try to build ios.

Thread 1: "Application tried to present modally a view controller <UIViewController: 0x7f9e930adc80> that is already being presented by <UIViewController: 0x7f9e9330d480>."

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
  InitializeFlipper(application);
#endif
  
  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  self.launchOptions = launchOptions;
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  #ifdef DEBUG
    [self initializeReactNativeApp];
  #else
    EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
    controller.delegate = self;
    [controller startAndShowLaunchScreen:self.window];
  #endif

  [super application:application didFinishLaunchingWithOptions:launchOptions];

  return YES;
}

2 Answers2

1

You can checkout my answer here

adding stuff here for ease,

We were using react-native-loading-spinner-overlay (we will call it Spinner) to show the progress bar, which internally uses Modal when we were transitioning from one screen to another we were not hiding the Spinner that lead to this issue.

Just hiding the Spinner & giving some delay before navigation it worked.

So in general if our code is trying to show one modal over other then we get into such issues, in react-native it is quite hard to find as we will have to see the lib code to understand if that is using modal.

Gokul Kulkarni
  • 2,069
  • 3
  • 26
  • 42
0

This error is because you already are presenting ViewController. First Try to dismiss that ViewController and then present it.

Saurav_Sharma
  • 130
  • 1
  • 10