Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React Native run iOS: Error: Could not connect to development server

$
0
0

I'm new to React Native, I'm trying to run my project on iPhone simulatorbut I keep getting red error screen: Could not connect to development server.

I changed the ip address in app delegate , and made sure that metro server is running on the same ip. and the address is accessible in Chrome and running. But no results whatsoever.

Error when running on iPhone simulator

Here is my appDelegate.m file:

    @implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];  NSURL *jsCodeLocation;  jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.103:8081/index.ios.bundle?platform=ios&dev=true"];  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions bridgeManagerDelegate:self];  [FIRApp configure];  return YES;}- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge{  NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];  // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!  return extraModules;}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif}@end

I've looked into and tried many answers on StackOverFlow. But no results whatsoever.

Any help?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>