phonegap / phonegap-template-react-hot-loader

PhoneGap Template using React, ES2015, Webpack, and hot module reloading
MIT License
79 stars 21 forks source link

My screen blank when run on ios emulator #2

Closed mrjumpy closed 8 years ago

mrjumpy commented 8 years ago

I just clone this repo and run on ios emulator. But only show blank on screen. anything I miss?

only different part I think: I use phonegap cli instead of Install the Cordova CLI

devgeeks commented 8 years ago

Make sure you have done all the steps...

phonegap create MyAppName --template react-hot-loader
cd MyAppName
npm install
phonegap platform add ios
npm start

Then open another terminal in the same directory... and...

npm run ios

or

phonegap run ios

Because the template has to bundle all the JS with Babel and WebPack, then it has to modify the config.xml and run the WebPack dev server. missing out on any of the steps above will give you the blank page you are experiencing.

mrjumpy commented 8 years ago

I've tried, still same. I think it should have some bug message here.

devgeeks commented 8 years ago

What version of PhoneGap are you using?

phonegap --version

What version of node/npm?

npm --version
node --version
mrjumpy commented 8 years ago

phonegap => 6.0.5 node => v5.8.0 npm => 3.7.3

devgeeks commented 8 years ago

OK. I have attempted to replicate using those exact versions and it's still working for me.

Make sure npm start is still running in another terminal when you phonegap run ios

devgeeks commented 8 years ago

Perhaps you could test it in the browser?

npm start

then point a browser at http://localhost:8080

mrjumpy commented 8 years ago

my browser is ok actually. only run on ios emulator will show blank. lol I think maybe something wrong on my enviroment.

and, this works for me. even in emulator. https://github.com/unimonkiez/react-cordova-boilerplate

I'll migrate my code to this project, if I find some error cause the problem, I'll inform you

devgeeks commented 8 years ago

One last thing you can do...

After running npm start and confirming it works in a browser, check config.xml and see if the content src entries are as follows:

<platform name="android">
        <content src="http://10.0.2.2:8080/index.html" />
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <content src="http://localhost:8080/index.html" />
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <allow-navigation href="http://*/*" />
    </platform>

We are looking to see if Android is <content src="http://10.0.2.2:8080/index.html" /> and iOS is <content src="http://localhost:8080/index.html" />

mrjumpy commented 8 years ago

👍 hey, you are right. Because I use react-router, so, the real path on is localhost:8080. no /index.html here. XD I think this should write it down on readme. big thanks! I don't have to migrate my code.

Lilliansiyin commented 7 years ago

Hi, I got err when npm start, it shows : node config && HOST=0.0.0.0 webpack-dev-server, how can I solve it? btw, when I run npm install, some warns show:

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN appstore@1.0.0 No description
npm WARN appstore@1.0.0 No repository field.
npm WARN appstore@1.0.0 license should be a valid SPDX license expression