Cordova Slack Digest

Sat, 30 Oct 2021 08:21:07 GMT

User count: 4667

Join the conversation at slack.cordova.io

Channel #cordova-ios (3 messages)


Fri, 29 Oct 2021 10:39:49 GMT

@marek.kozela says

Hi, could you give me, please, some guidance how to setup auto/hot reloading of cordova ios/cordova electron app? Is it possible to have build on iPad and having reloading the app while changing the code? Thanks a lot for help

Fri, 29 Oct 2021 13:02:28 GMT

@norman137 says

Cordova doesn‘t provide auto hot reloading out of the box. Cordova does provide a cordova serve command which will run a local web server that is able to serve the platform’s JS code. You‘ll be able to set the config’s <content src="" /> to your local webserver provided by cordova serve. The default network bind will be localhost:8000 so this will only work for local devices such as emulators. It will require some networking knowledge to get it working for physical devices other than your host work station.

For example, if you wanted to serve for the iOS platform, the content src url would look something like <http://localhost:8000/ios/www/index.html>

What this will do is let you pull in the JS sources from a server rather than the JS sources being bundled with the app. This allows you to change the JS sources / web assets without rebundling and redeploying the app. It does not do auto reloading, but you can reload the webview using ctrl+r (or cmd+r on macs) while the web inspector is focused. If you‘re skilled in networking, you can probably build a proxy server that communicates with both cordova’s server & a hot reload server.

Also, this is not for production use. Having executable sources being loading in remotely, and it accessing native device APIs is against the terms of many different app stores including Apple‘s App store, and Google’s Play store. So the cordova serve command can only really be used for development.

Fri, 29 Oct 2021 19:38:57 GMT

@ppetree says

A year or so ago, I was chatting with @sujan about the iOS share menu and how this is really only doable via xCode. Jan had mentioned that this could be scripted, does anyone know how to do this?