React Native using pre-bundled file on device, even if DEV-mode

A few days ago, when I build and run my react native app from Xcode on a device, I realised that even if I set my scheme to Debug, the app is still loading from a pre-bundled file. Other than that, everything else is like developer-mode. I can shake the device and the developer meny pop ups, in the console I get output, and react native also logs:

Running application “XXXXX” with appParams:
{“rootTag”:1,”initialProps”:{}}. DEV === true, development-level
warning are ON, performance optimizations are OFF

  • Landscape Apps Xcode 5 / iOS 7
  • Swift closures and async tasks
  • iOS7 Keyboard Return/Done/Search tint colour
  • Remove all non-numeric characters from an NSString, keeping spaces
  • Is it possible to position views on top of each other
  • iOS itunesconnect sandbox test account (Invalid Year)
  • So when I try to reload from the developer meny, it indeed reloads but with the message

    Loading from pre-bundled file

    I have tried to delete the app, verify Debug-scheme, clean build, and the build and run again, without any different outcome.

    Does anyone have a clue what could have caused this (I have been running the app before with Release Scheme, but never have had this issue), and how I can get back to “normal”?

    Unfortunately I do not know how to reproduce this.

    • Xcode: 8.2.1
    • React-native: 0.40.0

    Thank you for your time!

    Solved

    In my case, it was as @while1 pointed out regarding the wifi. My device and computer where not connected to the same wifi. I however found a network at my working place where it still didn’t work, even if both computer and device connected to this network (protected somehow maybe?). ANyway, when I shared my internet connection to my computer from my iPhone, the app finally loaded the data from my computer. So it indeed was the iPhone not being able to connect to my computer, and therefore loading a pre-bundled file.

    3 Solutions Collect From Internet About “React Native using pre-bundled file on device, even if DEV-mode”

    In react native 0.40.0, React native try to guess bundle location by itself. Please see if following points can help:

    • Make sure your AppDelegate.m have this line:jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

    • Check your device and your Xcode mac is running on same wifi. Internally for IOS, react native try to guess ip by itself.

    • Try running app first through command line, so dev packager server is running and then run app through xcode in your device.

    so your problem is here:

    Change code in your AppDelegate.m:

    jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; // comment this line
    
    jsCodeLocation = [NSURL URLWithString:@"http://xxx.xxx.x.xx:8081/index.ios.bundle?platform=ios&dev=true"]; //uncomment this line  
    

    Cheers:)

    For those who are connected to the same Wi-Fi, but to a different IP address than localhost (you’ve set it up in RCTWebSocketExecutor.m):

    Check Xcode debug console, if you can find the following error:

    App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
    
    1. Use the following answer: https://stackoverflow.com/a/32704702/3979621

    2. And then use Codesingh’s answer. BTW I recommend using the #ifdef DEBUG directive as follows, so that you don’t have to change it manually when switching between build variants:

    .

    #ifdef DEBUG
      jsCodeLocation = [NSURL URLWithString:@"http://xxx.xxx.xxx.xxx:8081/index.ios.bundle?platform=ios&dev=true"];
    #else
      jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
    #endif