Running react-native app on iOS device using offline bundle

前端 未结 6 1162
广开言路
广开言路 2020-12-14 09:37

The official React Native documentation to run app on iOS device using offline bundle says

Open ios/YourApp/AppDelegate.m

Uncomment the line, jsCo

6条回答
  •  星月不相逢
    2020-12-14 10:11

    When I open the global proxy in ShadowsocksX, automatic IP detection won't return http://localhost:8081/index.ios.bundle in the debug mode. That's why the URL for main.jsbundle returned as null.

    How to solve?

    Option 1:

    replace

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

    with

    jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
    

    This method could disable automatic IP detection.

    Option 2:

    Switch your proxy mode if you open the global proxy mode.

提交回复
热议问题