2015-03-31 70 views
4

在iPhone模擬器上一切正常。在構建應用程序的iPhone我得到的錯誤:如何爲iPhone構建React Native App?

A bundleURL is required to create an RCTRootView

AppDelegate.m我去掉下面行的;

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

並下載了預生成main.jsbundle到項目的根文件夾的iOS:

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

我試圖在AppDelegate.swift中做這個 - 似乎沒有工作 - 在這裏也被問到:https://github.com/facebook/react-native/issues/240 – wantrapreneur 2016-06-08 21:41:38

回答

10

我忘了將文件添加到項目中。

您需要項目名稱右鍵單擊並選擇「將文件添加到MyProject的......」。然後選擇main.jsbundle。建立該項目,它應該工作。

+1

是啊,或者只是下載在應用程序的根目錄內的iOS文件夾的main.jsbundle而不是根目錄本身。 – 2015-03-31 22:22:43