RCTBridge需要dispatch_sync来加载RCTDevSettings。这可能会导致死锁

时间:2017-05-22 08:24:49

标签: react-native

当我将RN从0.32升级到0.44时,对16.0.0-alpha.6作出反应。 当我在Xcode上运行应用程序。我得到错误:

enter image description here

1 个答案:

答案 0 :(得分:0)

打开您的/ios/YourAppName/AppDelegate.m

#import "AppDelegate.h"

// ADD THIS
#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
// TILL HERE

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

...
  RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
                                            moduleProvider:nil
                                             launchOptions:launchOptions];
// THIS CONDITION
#if RCT_DEV
  [bridge moduleForClass:[RCTDevLoadingView class]];
#endif
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Test"
                                            initialProperties:nil];
// TILL HERE
  ...
}

为我工作! 来源here