Network Request Failed – App running on IOS

Context:

  • I have a mobile app with a login functionality that sends a POST request to a local API hosted on my PC at http://192.168.1.110:8000/api/login or (http://127.0.0.1:8000/api/login).
  • The code works perfectly on an emulator but fails on a physical iPhone with a “Network request failed” error and a console warning about an unhandled promise rejection.
const response = await fetch(
        'http://192.168.1.110:8000/api/login?email=' +
          `${email}` +
          '&password=' +
          `${password}`,
        {
          method: 'POST',
          headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
          },
        },
      );

Troubleshooting Steps Taken:

  • Verified firewalls on your PC and router are not blocking the connection.
  • Confirmed both the iPhone and PC are on the same Wi-Fi network.