I'm trying to enable Live Reload mode, but there is no such item in Dev Menu:
相关问题
- Core Data lightweight migration crashes after App
- React Native Inline style for multiple Text in sin
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Why do we have to call `.done()` at the end of a p
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- Remove expo from react native
You need to edit the source for
jsCodeLocation
from your AppDelegate.The main problem that the
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
is looking for
localhost
by default, in simulator it will work as simulator and pc are on the same machine, but for devicelocalhost
will be different so to make it work, you need to change that line tojsCodeLocation = [NSURL URLWithString:@"http://192.168.1.16:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true"];
here
192.168.1.16
change it to your PC local IP addressYou have this problem is mainly because your device and your development machine is not in the same LAN. check if it is. Make sure your computer and your device connected in the save LAN, everything will be ok.
After all ur devices connected to the same LAN. And if u are using Xcode.
npm start -- reset-cache
Then everything will be OK.
If u are using IOS Simulator, follow the menu
Hardware > Shake Gesture
, and click theEnable Live Reload
option.Hope it helps! :)
In my case, I had a local ethernet connection that was taking priority on en0, so I had to change the script at:
node_modules/react-native/react-native-xcode.sh
from
IP=$(ipconfig getifaddr en0)
to
IP=$(ipconfig getifaddr en1)
since my wifi was on that port. Verify that with terminal:
networksetup -listallhardwareports
All this I learned from the following blog post:
https://www.stevetrefethen.com/blog/react-native-bundle-loading-failing-on-a-physical-device
Thanks Steve Trefethen!
I'm not sure what the permanent solution should be, but it seems the script should be checking for wifi only connections somehow.
If you are running the simulator, make sure you sure you "Connect Hardware Keyboard"
If you are running the app on your actual native device. Then shake the device and it will pop up the me menu.