react-native: It is not possible anymore to hot reload or debug on a real device
Issue Description
I want to debug an app on my iPhone but when i press the ‘Debug JS Remotely’ it crashes with the error ‘’ and the button ‘Hot Reload’ is not even visible.
It seems like the packager is building always a pre built bundle of the app. There is no ‘loading from xy’ message at the top anymore and the build phase ‘Bundle React Native code and images’ inside Xcode takes really long.
Code Snippets
AppDelegate.m
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Fabric with:@[[Crashlytics class]]];
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Watchlist"
initialProperties:nil
launchOptions:launchOptions];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
Expected Results
Debug with Google Chrome and use the hot reload feature.
Additional Information
- React Native version: 0.31.0 and 0.32.0
- Platform: iOS
- Operating System: osx 10.11.6
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 20 (2 by maintainers)
Commits related to this issue
- Added option to disable xip Summary: When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doe... — committed to facebook/react-native by deleted user 7 years ago
- Added option to disable xip Summary: When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doe... — committed to facebook/metro by deleted user 7 years ago
- Added option to disable xip Summary: When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doe... — committed to thotegowda/react-native by deleted user 7 years ago
@robts my pr (https://github.com/facebook/react-native/pull/13326) got merged recently so I’m guessing it will be included in the next release
I experienced the same problems with similar setups to everyone. I prefer NOT to hardcode or revert back to the old way (< RN 0.29) since that then takes away all the work that went into making the device load from the development server (when available) and prebundled (when not)… and also having the correct settings for you go into release.
Strangely, my problem got solved by simply removing
.xip.io
from line 83 in react-native-xcode.sh.https://github.com/facebook/react-native/blob/master/packager/react-native-xcode.sh
If you look at the script, which is run every time you build, it already handles putting exceptions into the .plist file when in debug.