RCTBridge 需要 dispatch_sync 来加载 RCTDevLoadingView

Lee*_*fin 5 react-native react-native-ios

我正处于 react-native 的学习阶段。当我在模拟器上运行我的应用程序时,我收到以下警告,但如何调试此错误?我不确定要检查什么以及在哪里检查以摆脱此错误,有人可以指导我吗?我在 iOS 模拟器上运行。

在此处输入图片说明

Muh*_*man 13

我能够通过更新 AppDelegate.m 来解决警告

#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
                                            moduleProvider:nil
                                             launchOptions:launchOptions];
#if RCT_DEV
  [bridge moduleForClass:[RCTDevLoadingView class]];
#endif
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Test"
                                            initialProperties:nil];
  
}

Run Code Online (Sandbox Code Playgroud)