How do you run on a physical device as of rn 0.29? …with Reload JS working

I can no longer run in a physical device, I just get Could not connect to development server. The docs seem to be quite out of date.

Questions:

What do I put in my AppDelegate.m? It used to looks like this (modified from the original to allow me to access my dev server from a physical device):

  #ifdef DEBUG
    jsCodeLocation = [NSURL URLWithString:@"http://<my-ip-address>:8081/index.ios.bundle?platform=ios&dev=true"];
  #else
    jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif

But since the upgrade its changed to this:

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

If i don’t make any changes I can run on a physical device, but Reload JS doesn’t work. Is it possible to load js code on the fly as before?

What do I put in my Info.plist file for NSAppTransportSecurity ? The default settings are now:

    <key>NSAppTransportSecurity</key>
    <!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>

Tried changing localhost to my <my-ip-address> but it doesn’t seem to work.

Is there a configuration that allows my to test both a physical device and a simulator without having to change code each time?

Author: Fantashit

2 thoughts on “How do you run on a physical device as of rn 0.29? …with Reload JS working

  1. +1 would be good to have docs for this because the new default template doesn’t support debugging on the device

Comments are closed.

How do you run on a physical device as of rn 0.29? …with Reload JS working

I can no longer run in a physical device, I just get Could not connect to development server. The docs seem to be quite out of date.

Questions:

What do I put in my AppDelegate.m? It used to looks like this (modified from the original to allow me to access my dev server from a physical device):

  #ifdef DEBUG
    jsCodeLocation = [NSURL URLWithString:@"http://<my-ip-address>:8081/index.ios.bundle?platform=ios&dev=true"];
  #else
    jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif

But since the upgrade its changed to this:

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

If i don’t make any changes I can run on a physical device, but Reload JS doesn’t work. Is it possible to load js code on the fly as before?

What do I put in my Info.plist file for NSAppTransportSecurity ? The default settings are now:

    <key>NSAppTransportSecurity</key>
    <!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>

Tried changing localhost to my <my-ip-address> but it doesn’t seem to work.

Is there a configuration that allows my to test both a physical device and a simulator without having to change code each time?

Author: Fantashit

1 thought on “How do you run on a physical device as of rn 0.29? …with Reload JS working

  1. +1 would be good to have docs for this because the new default template doesn’t support debugging on the device

Comments are closed.