最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to build React Native App for iPhone? - Stack Overflow

programmeradmin5浏览0评论

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 unment 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

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 unment 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
Share Improve this question edited Apr 1, 2015 at 7:30 mosch asked Mar 31, 2015 at 17:06 moschmosch 1,0351 gold badge12 silver badges24 bronze badges 1
  • I'm trying to do this inside an AppDelegate.swift - doesn't seem to work - Asked here also: github./facebook/react-native/issues/240 – wantrapreneur Commented Jun 8, 2016 at 21:41
Add a ment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论