Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build React Native App for iPhone?

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
like image 982
mosch Avatar asked Mar 31 '15 17:03

mosch


People also ask

Can you make iPhone apps with React Native?

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.

Is React Native good for iOS?

React Native is the best choice if you: It is necessary to develop an application for both iOS and Android platforms, with limited resources and a small team; Your app needs to look and work the same on both iOS and Android; Need live or hot reload and faster time to develop the application.


1 Answers

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.

like image 154
mosch Avatar answered Oct 06 '22 09:10

mosch