What is the meaning of 'No bundle URL present' in react-native?

前端 未结 30 2317
庸人自扰
庸人自扰 2020-11-30 17:22

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.

30条回答
  •  攒了一身酷
    2020-11-30 17:34

    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.

提交回复
热议问题