Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch react-native(0.29) on iOS physical device(9.3) #8647

Closed
brennanerbz opened this issue Jul 8, 2016 · 15 comments · May be fixed by hixio-mh/react-native#30
Closed

Unable to launch react-native(0.29) on iOS physical device(9.3) #8647

brennanerbz opened this issue Jul 8, 2016 · 15 comments · May be fixed by hixio-mh/react-native#30
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@brennanerbz
Copy link

Only using the react-native-cli starter without changing any app code, I've done everything possible to launch on physical device.

I've followed the react-native docs, changed the IP address to my mac's, provisioned my phone, everything. Please help, as I've spent hours on this.

It seems the react-native0.29 AppDelegate file is different than 0.21. Could this be problem?

Here's the error screenshot:
img_0210

@rogchap
Copy link
Contributor

rogchap commented Jul 8, 2016

Looking at the code, it seems that you need an ip.txt file in your main bundle:

https://github.com/facebook/react-native/blob/master/React/Base/RCTBundleURLProvider.m#L29

@rogchap
Copy link
Contributor

rogchap commented Jul 8, 2016

Looking further:

echo "$IP.xip.io" > "$DEST/ip.txt"

Seems that the packager should create this file. I think this means that you should not have to change anything to run on your device.

@DanielMSchmidt
Copy link
Contributor

@facebook-github-bot stack-overflow

@ghost
Copy link

ghost commented Jul 8, 2016

Hey @brennanerbz and thanks for posting this! @DanielMSchmidt tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.

@ghost ghost added the For Stack Overflow label Jul 8, 2016
@ghost ghost closed this as completed Jul 8, 2016
@ghost ghost added the Ran Commands One of our bots successfully processed a command. label Jul 8, 2016
@npomfret
Copy link
Contributor

thanks @rogchap - since upgrading to rn 0.29 i can no longer run on a physical device. I'm getting the "Could not connect to development server" error. Have the commands changed that I need to run?

Before I was just running npm start.

@rogchap
Copy link
Contributor

rogchap commented Jul 13, 2016

Have you updated your AppDelegate? It's completely changed from previous
versions.
On Wed, 13 Jul 2016 at 20:23, Nick Pomfret notifications@github.com wrote:

thanks @rogchap https://github.com/rogchap - since upgrading to rn 0.29
i can no longer run on a physical device. I'm getting the "Could not
connect to development server" error. Have the commands changed that I need
to run?

Before I was just running npm start.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#8647 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAQfrPtHMnX_jby6qQuKCyc30HF39UyEks5qVLyEgaJpZM4JHpie
.

@npomfret
Copy link
Contributor

npomfret commented Jul 13, 2016

Completely changed? What's different? The only thing I noticed was:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

Yes, I've got that. So how do now load js files from a physical device? I use'd to just specify an ipaddress (jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.64:8081/index.ios.bundle?platform=ios&dev=true"];). But that's not an option any more. The docs are out of date as well.

@rogchap
Copy link
Contributor

rogchap commented Jul 13, 2016

Have you run '$ react-native upgrade' to upgrade your templates?

There are some script files that copy your IP address into a ip.txt file
that is used to access your local machine.

In 0.29.x you do not need to make any changes to run on a physical device.
Just be on the same WiFi network.
On Wed, 13 Jul 2016 at 23:39, Nick Pomfret notifications@github.com wrote:

Completely changed? What's different? The only thing I noticed was:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings]
jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

Yes, I've got that. So how do now load js files from a physical device? I
use'd to just specify an ipaddress (jsCodeLocation = [NSURL
URLWithString:@"
http://192.168.1.64:8081/index.ios.bundle?platform=ios&dev=true"];). But
that's not an option any more. The docs are out of date as well.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#8647 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAQfrBf0FHfbOG-r0ZIEFIwB8k1NT8oHks5qVOqZgaJpZM4JHpie
.

@npomfret
Copy link
Contributor

Yes, I've run react-native upgrade. Maybe i missed something in the merge process, but I can't see what. My phone will only load the pre packaged JS files now. What should I look for? How does the phone know which ip address to use?

@longsangstan
Copy link

https://facebook.github.io/react-native/docs/running-on-device-ios.html

Seems that the docs are out-dated.

@strefethen
Copy link

@npomfret Did you manage to get this resolved? I have the same issue in that my app no longer connects to the packager and only uses the bundled JS. I have ATS setup with an exception for localhost but I believe that was the default setup when I created my app.

Thanks

@npomfret
Copy link
Contributor

Yes, see my comments here #8358

No idea if its the right thing to do, but as far as I can tell the documented solution is wrong.

@strefethen
Copy link

@npomfret I dug into this a bit more and found that my problem was related to how the react-native-xcode.sh script creates the IP.txt file when the machine is only on wifi. It uses ipconfig getifaddr en0 which returns blank. I explained the rest here:

http://www.stevetrefethen.com/blog/react-native-bundle-loading-failing-on-a-physical-device

Basically, you should not have to hard code your IP address in AppDelegate.m it should "just work", if your machine is connected on "en0" that is.

@npomfret
Copy link
Contributor

Right so if you have 2 or more network interfaces, which I do - you need to make sure that the node process binds to the wifi and not the ethernet? How on earth do you do that? I want to use ethernet when its available, not wifi, so I'd rather not bump wifi to the top of the list. I guess that's just not possible now

@strefethen
Copy link

Unfortunately, I don't have a great answer other than tweaking react-native-xcode.sh to look at the right device for writing out the IP.txt file. At least I understand what's really happening now. :|

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants