react-native No bundle URL present

I resolved it with the following solution:

Edit <your_project_folder>/ios/<project_name>/AppDelegate.m and change the jsCodeLocation variable as follows:

jsCodeLocation =
    [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true"];

For those still interested i resolved this just by running

react-native start

which starts the packager in the current terminal window and run in other terminal window

react-native run-ios

This happens to me when I work on the same react-native project on different computers. Closing the simulator and deleting the ios > build folder followed by running react-native run-ios again solves it for me.


Your issue is that the file main.js bundle part of iOS is not generated all the times or sometimes is generated, but wrong. To solve the issue, follow these steps:

  1. Add the following line inside the scripts of the package.json

    "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"

  2. Then run following command:

    yarn build:ios or npm run build:ios

  3. Open Xcode, select "project", then click the project name; go to the "build phases", then click on "copy build resources" as your main.js bundle there

  4. Run the react-native run-ios

This works for me

Tags:

React Native