2

After following the instruction on the website, I got this error when I try to build on iOS:

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

https://i.stack.imgur.com/7tUUE.png

phone error

Info.plist

<key>MoEngage</key>
<dict>
    <key>MoEngage_APP_ID</key>
    <string>...</string>
</dict>
...

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
  // Set Data Center
  [MoEngage setDataCenter:DATA_CENTER_01]; //DATA_CENTER_01, DATA_CENTER_02, OR DATA_CENTER_03
  
  [[MOReactInitializer sharedInstance] intializeSDKWithLaunchOptions:launchOptions];
  
  return YES;
}
Huan Huynh
  • 399
  • 6
  • 16

2 Answers2

0

MoEngageSDK presents the ViewController only incase of RichLanding. The above mentioned error points to the

react-native-splash-screen

plugin as you are calling [RNSplashScreen show]; in AppDelegate. So the issue seems to be from react-native-splash-screen plugin.

Also, for the other error. You need to make sure

[[MOReactInitializer sharedInstance] intializeSDKWithLaunchOptions:launchOptions]

is being initialized properly.

Also, you can check with the support team of moengage to resovle this at https://help.moengage.com/

0

I got the issue fixed, for me it's because two lines in the file AppDelegate is putting in wrong position. Make sure these:

  [MoEngage setDataCenter:DATA_CENTER_01]; //DATA_CENTER_01, DATA_CENTER_02, OR DATA_CENTER_03
  
  [[MOReactInitializer sharedInstance] intializeSDKWithLaunchOptions:launchOptions];

are in right position of the (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions function, in my case is to put them right before:

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"finan"
                                            initialProperties:nil];

rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
Huan Huynh
  • 399
  • 6
  • 16