加载RCTAppState的常量所需的dispatch_sync。这可能导致死锁

时间:2018-09-06 14:45:42

标签: swift reactjs react-native

我是React-Native的新手,我已经多次看到此错误,对于某些人来说,这听起来完全陌生

错误

  

必需的dispatch_sync才能加载RCTAppState的常量。这可能   导致僵局

现在,谷歌搜索并检查出stackoverflow时,我看到了两个线程

一个是:RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

和github上的一个:https://github.com/facebook/react-native/issues/16376

现在,尽管他们给出了解决方案,但看来解决方案还是在我无法理解的快速目标C上,他们也没有对它进行解释(例如我们在做什么和引起它的原因)

例如:这是什么意思?

#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];
  ...
}

有人可以帮助我理解吗?另外,React-native是否要求您具有使用Swift的知识经验? (如果您正在进行iOS开发)和Java(对于android)

0 个答案:

没有答案