When I run a react-native project, I get a error no bundle URL present
, but I don\'t know what mistakes I do, I was very confused.
I'm working with RN 0.49.5
.
I've tried lots of methods, but no one works. Finally i worked this out.
It's simple and easy.
Main idea is to change the localhost
to 127.0.0.1
, but it's not where the RN tells you. It's in RCTBundleURLProvider.m#- (BOOL)isPackagerRunning:(NSString *)host.
Changes of code:
oc
- NSString *host = ipGuess ?: @"localhost";
+ NSString *host = ipGuess ?: @"127.0.0.1";
This is ok for simulator. If it's device, just change the ip address to your machine's.