0

按照网站上的说明进行操作后,当我尝试在 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

电话错误

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;
}
4

2 回答 2

0

MoEngageSDK 仅在 RichLanding 的情况下提供 ViewController。上述错误指向

反应原生闪屏

[RNSplashScreen show];您在 AppDelegate中调用的插件。所以问题似乎来自react-native-splash-screen插件。

另外,对于另一个错误。你需要确保

[[MOReactInitializer sharedInstance] intializeSDKWithLaunchOptions:launchOptions]

正在正确初始化。

此外,您可以在https://help.moengage.com/与 moengage 的支持团队联系以解决此问题

于 2021-11-22T06:13:55.053 回答
0

我解决了这个问题,对我来说这是因为文件中的两行AppDelegate放在错误的位置。确保这些:

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

在函数的正确位置(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions,在我的情况下是把它们放在前面:

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];
于 2021-11-22T07:20:06.433 回答