问题
I can't figure out how to use livereload with ionic 4 and Capacitor on ios.
I'm running this command
ionic cap run ios -l
which add my local ip address to capacitor.config.json
.
however, it seems like I'm missing something in here.
Note: according to Provide live-reload functionality #3130 this should work.
my environment setup:
Ionic:
ionic (Ionic CLI) : 4.1.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.2
@angular-devkit/core : 0.7.3
@angular-devkit/schematics : 0.7.3
@angular/cli : 6.1.3
@ionic/ng-toolkit : 1.0.6
@ionic/schematics-angular : 1.0.5
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.6
@capacitor/core : 1.0.0-beta.6
System:
NodeJS : v9.10.1 (/usr/local/bin/node)
npm : 6.4.0
OS : macOS High Sierra
回答1:
For those still struggling with his try:
ionic capacitor run ios --livereload --external
It will open Xcode automatically. Run your project and livereload should work.
Make sure that you are connected to the same WiFi on your device and computer.
回答2:
Thanks to Julio Cesar form ionic team for pointing this out, this turned to be a bug in Capacitor which has a PR already github.com/ionic-team/capacitor/pull/741 and github.com/ionic-team/capacitor/pull/742
回答3:
It didn't work for me as well until I added "cleartext": true
to capacitor.config.json
under server
. Like this:
"server": {
"url": "http://192.168.1.68:8100",
"cleartext": true
}
This is explained in the official documentation under Using with Framework CLIs.
来源:https://stackoverflow.com/questions/51880929/capacitor-livereload-not-working