5

On the iPhone simulator everything works fine. When building the App for the iPhone i get the error:

A bundleURL is required to create an RCTRootView

In the AppDelegate.m i uncomment the following line;

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

And downloaded the prebuild main.jsbundle to the iOS folder in the project root:

curl http://localhost:8081/index.ios.bundle -o main.jsbundle
mosch
  • 1,005
  • 1
  • 12
  • 24
  • I'm trying to do this inside an AppDelegate.swift - doesn't seem to work - Asked here also: https://github.com/facebook/react-native/issues/240 – wantrapreneur Jun 08 '16 at 21:41

1 Answers1

11

I forgot to add the file to the project.

You need to right-click on the project name and select "Add files to MyProject…". Then choose the main.jsbundle. Build the project and it should work.

mosch
  • 1,005
  • 1
  • 12
  • 24
  • 1
    Yeah, or just download the main.jsbundle to the iOS folder inside the root directory of the app instead of the root directory itself. – Mike Driver Mar 31 '15 at 22:22