Answers · Mobile

How do I test a Hotwire Native app against a local dev server?

Change the URL in the shell to your machine's LAN address, such as http://192.168.1.20:3000. An iOS simulator can reach localhost but a physical device cannot, because localhost on the phone is the phone. Both platforms also block plain HTTP by default, so development needs an explicit exception.

Find the address and bind to it

ipconfig getifaddr en0
bin/rails server -b 0.0.0.0

The bind flag is the step people miss. By default Rails listens on loopback only, so the phone's request never arrives even with the right address. bin/dev runs the same server, and the same flag applies.

The two platform rules

iOS blocks non-HTTPS requests under App Transport Security. The simulator is more permissive than a device, which is why a build that works in the simulator fails on a phone.

Android blocks cleartext traffic by default from API 28 onward, with a similar result.

Both need a development-only exception in the shell's configuration, under mobile/ios or mobile/android depending on the platform. Add it deliberately and remove it before you submit, because shipping an app that permits cleartext is both a security problem and something review may flag.

The alternative that avoids all of it

Run a tunnel and use HTTPS:

bin/dev

Then expose it with whichever tunnel you use and point the shell at the public HTTPS URL. No transport exceptions, no LAN addressing, and it works from a device on cellular. Worth it if you test on hardware often.

Same network, actually

Phone and laptop on the same Wi-Fi, and a network that does not isolate clients. Guest networks frequently do, and the symptom is a request that simply times out with nothing in the Rails log. Nothing in the Rails log means the request never arrived, which is a network problem rather than an app problem.

Remember APP_HOST

Mailers and canonical URLs read Rails.application.config.x.app_host rather than the request. On a LAN address they will point somewhere the phone cannot follow, which is fine for development and worth knowing when a sign-in link in the app does not work.

Related questions

Do I need a Mac to build and submit an iOS app?

Practically, yes. Xcode runs only on macOS and it is what archives, signs and uploads an iOS build. Cloud macOS runners and rented Macs work and add cost and latency. Android has no equivalent constraint: the Android shell builds on Linux, macOS or Windows.

How do I set the app icon and name for a Hotwire Native shell?

The icon is an asset catalog entry in the shell project and the display name is a value in its configuration, both under mobile/ios or mobile/android. Unlike your screens, these are compiled in, so changing either needs a new build and a new submission. Set them before your first upload.

Can I put a Rails app in the App Store and Play Store?

Yes. Hotwire Native wraps your existing web views in a native shell, so the screens you already built are the screens in the app. One Shot ships both shells in mobile/ios and mobile/android. The rule you cannot route around is that digital subscriptions have to use the platform's in-app purchase, not Stripe.