React Native app on device won't connect to local server

Viewed 32

I have a server running on localhost:8000, and an app launched through XCode, but I can't get the app to hit the correct API points. I've tried the following:

Changed info.plist to allow for http

<key>NSAllowsLocalNetworking</key>
        <true/>
        <key>NSExceptionDomains</key>
            <dict>
            <key>192.xxx.x.xxx</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPSLoads</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSTemporaryExceptionMinimumTLSVersion</key>
                <string>1.0</string>
                <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            </dict>

Tried the following routes using TRPC

      //return `http://myAppName.local:8000`;
      // return 'http://166.xxx.xx.xx:8000' (both IP address from google's get my ip and the ip listed on my Mac's network tab)
      // return 'http://localhost:8000'
      // return 'http://0.0.0.0:8000'
      // return 'http://2c5f-166-205-91-44.ngr' <-- ngrok 

I've tested the above routes in my web browser and my node server log recognizes that it's been reached. However, I get no such response from my iphone My firewall is also down, so I don't think it's that.

This has been driving me crazy all day. Any thoughts?

0 Answers
Related