Answers for "RCTBridge required dispatch_sync to load RCTDevLoadingView warning how to turn off"

2

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

// I was able to workaround the warning by updating 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];
  ...
}

// this workaround solved the warning. Thank you very much.

//For anyone using this solution, if your xcode crashes and throws an error at initWithBundleURL: jsCodeLocation, substitute jsCodeLocation =

NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.js" fallbackResource:nil];

// This solved the issue for me
Posted by: Guest on August-10-2021

Code answers related to "RCTBridge required dispatch_sync to load RCTDevLoadingView warning how to turn off"

Code answers related to "Swift"

Browse Popular Code Answers by Language