Could not connect to development server. Ensure node server is running
I run the 2048 example on Xcode and run the IOS simulator, an error occurs:

Did you try running npm start from react-native directory?
I get this error as well when I try to run on real ios device through xcode. Is that expected?
Run npm start on local machine to start the development server. React Native relies on a development server to communicate with the app running in the simulator.
Ok, I will try it, I see the AppDelegate.m :
// Loading JavaScript code - uncomment the one you want.
// OPTION 1
// Load from development server. Start the server from the repository root:
//
// $ npm start
//
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
// iOS device are on the same Wi-Fi network.
Maybe you should write it in a wiki(How to run examples ?). It's easy to freshman.
I see this error even after running 'npm start'. Do I need to make any changes to AppDelegate.m file?
OK. fixed the issue. I had to change the port from 8081 to 8881 as the default port is used by another process on my mac. Modifying AppDelegate.m to point to the new port worked.
// OPTION 1
// Load from development server. Start the server from the repository root:
//
// $ npm start
//
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
// iOS device are on the same Wi-Fi network.
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8881/index.ios.bundle"];
where is react-native directory?
@ikallen
The "react-native directory" refers to the folder where your own source-code is located.
I think "react-native root" within the error could be more clear which just as @brownieboy said, refers to the folder where the source code located.
It worked for me -> open the APP folder in the terminal and running "react-native start". Here you can also check on which port it is running and set the same.
I can load this URL just fine in my browser: http://localhost:8081/index.ios.bundle?platform=ios&dev=true but I still get this error. My AppDelegate appears like so:
let jsCodeLocation = NSURL(string: "http://localhost:8081/index.ios.bundle?platform=ios&dev=true")
let rootView = RCTRootView(bundleURL: jsCodeLocation, moduleName: "App", initialProperties: nil, launchOptions: launchOptions)
let rootViewController = ViewController()
rootViewController.view = rootView
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.rootViewController = rootViewController
self.window?.makeKeyAndVisible()
return true
In iOS 9.0+ Apple by default blocks non-secure (http) requests. I had to add this to my Info.plist

Jamesfzhang I am having the same error as you, what is the full name of the boolean you added at the end?
And does the app transport security settings dictionary live in the information list dictionary?
Thanks
@adamsythe The boolean is NSTemporaryExceptionAllowsInsecureHTTPLoads, and yes this is in the information list dictionary.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Thanks my error disappeared when I updated my operating system :)
I can also load the dev server resource in my browser, and also updated my info.plist as jamesfzhang suggested. But I'm still getting the red screen connection error message.
Now I tried to to access the dev server resource (http://[my ip]:8081/index.ios.bundle?platform=ios&dev=true ) through a browser on my device, and that page doesn't load. I'm sure my workstation and device is on the same network. Could this be a closed port issue?
Getting the exact same error. No problem loading from browser, can't fetch from simulator. tried @jamesfzhang solution, but still having same error. Anyone found a solution?
I had to change the address of the dev server in the following file as well:
Libraries/RTCWebSocket.xcodeproj/RTCWebSocketExecutor.m
Pungsnigel, can you load the dev server resource from a browser in your device?
I fixed this with using npm start in my project directory and hit the run button
Have you tried adding your IP to list of NSExceptionDomains?