Network Error with post request on iPhone

Hey there - I’ve been developing with the iOS simulator and moved over to try my progress on my iPhone. When I try to log in, I don’t seem to be able to make a post request. The code is fine, as it works on the simulator, however in the device, I get a network error.

I have tried using axios (the console error I get is Error: Network Error) and fetch, where I get TypeError: Network request failed. Neither of these error messages are helpful. The output from the expo XDE is below.

Is there something else I need to do to enable post requests on the iPhone?

{"config":{"transformRequest":{},"transformResponse":{},"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"},"method":"post","url":"https://localhost:3000/api/v1/users/request","data":"{\"phone\":\"redacted\"}"}}

Just wondering if anybody has any ideas for this one? Much appreciated.

I worked it out. I had to serve my rails server on my local IP address instead of localhost.

How do you solve it? by changing the localhost to local IP address ?

I’ve server running on and in my apps I request from my api server with the address (my Mac local address).

Still it gives me network request failed.