如何为iPhone构建React Native App? [英] How to build React Native App for iPhone?

查看:146
本文介绍了如何为iPhone构建React Native App?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPhone模拟器上一切正常。在为iPhone构建应用程序时,我收到错误:

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


创建RCTRootView需要使用bundleURL

A bundleURL is required to create an RCTRootView

AppDelegate.m 中,我取消注释以下行;

In the AppDelegate.m i uncomment the following line;

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

并将prebuild main.jsbundle下载到项目根目录中的iOS文件夹中:

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

curl http://localhost:8081/index.ios.bundle -o main.jsbundle


推荐答案

我忘了将文件添加到项目中。

I forgot to add the file to the project.

您需要右键单击项目名称,然后选择将文件添加到MyProject ...。然后选择 main.jsbundle 。建立项目,它应该工作。

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.

这篇关于如何为iPhone构建React Native App?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆