镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Closed
sniten/react-native
#30

Description

@brennanerbz

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

Activity

  1. rogchap commented on Jul 8, 2016

    @rogchap
    Contributor

    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

  2. rogchap commented on Jul 8, 2016

    @rogchap
    Contributor

    Looking further: https://github.com/facebook/react-native/blob/8c29a52c54392ce52148e7d3aa9f835537453aa4/packager/react-native-xcode.sh#L77

    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.

  3. DanielMSchmidt commented on Jul 8, 2016

    @DanielMSchmidt
    Contributor

    @facebook-github-bot stack-overflow

  4. ghost closed this as completedon Jul 8, 2016
  5. ghost added
    Ran CommandsOne of our bots successfully processed a command.
    on Jul 8, 2016
  6. npomfret commented on Jul 13, 2016

    @npomfret
    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.

  7. rogchap commented on Jul 13, 2016

    @rogchap
    Contributor

    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
    .

  8. npomfret commented on Jul 13, 2016

    @npomfret
    Contributor

    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.

  9. rogchap commented on Jul 13, 2016

    @rogchap
    Contributor

    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
    .

  10. npomfret commented on Jul 14, 2016

    @npomfret
    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?

  11. longsangstan commented on Aug 3, 2016

    @longsangstan
  12. strefethen commented on Aug 22, 2016

    @strefethen

    @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

  13. npomfret commented on Aug 23, 2016

    @npomfret
    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.

  14. strefethen commented on Aug 23, 2016

    @strefethen

    @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.

  15. npomfret commented on Aug 24, 2016

    @npomfret
    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

  16. strefethen commented on Aug 25, 2016

    @strefethen

    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. :|

  17. locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions