-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network request failed || expo || iOS device #25597
Comments
Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety? 👉 Click here if you want to take another look at the Bug Report issue template. |
Hi @AlexisChup, It seems you are trying to access a local API endpoint, running on your desktop computer, from your iOS device. To pinpoint the issue:
|
Hi @RobinCsl Yes, that's it. I'm connected in the same network in both. I've tried your API example, and it works on my emulator and my iOS device. I'm using other API but there are started by 'https'. Here the problem seem to be the 'http'. However I tried to fixed it by add "NSAppTransportSecurity" : "true" in the infoPlist in the app.json, but nothing change. Like I say upper. I've also try to connected to internet in an other home, change the IPv4. But still the issue. I really don't have other ideas to fix it. Thanks for your time ! |
WorkaroundI finally find a workaroud : When I typed http://"My_IPv4_address":8000/"My_Api" on my computer, he said : "ERR_CONNECTION_REFUSED" So I tried to run $ php bin/console server:run "My_IPv4_address":8000 A firewall notification appears to me, I accept it. So I need to run $ php bin/console server:run and in a other powershell $ php bin/console server:run "My_IPv4_address":8000 to have access to my local API in my android emulator and my iOS device. |
Glad you figured it out! |
🐛 Bug Report
What I would like to do
I'm try to send a request to my API (created with ApiPlatform) in local in my React Native app with my ios device on expo.
Here the request that I want to do : "http://127.0.0.1:8000/api/beers"
What works
My request works on my computer
My request works on my android emulator by typing that : "http://10.0.2.2:8000/api/beers"
What I've done
For the ios Device on expo, I've read that I need to change 127.0.0.1:8000 by the Ipv4 of my computer, so I ran
in a powershell, and get my Ipv4 address, put in my request : "http://172.20.10.2:8000/api/beers"
I've read that ios doesn't allow http protocole, so I add in my app.json -> infoPlist -> NSAppTransportSecurity -> true
Like all the other topic said, but always the same error : "Network request failed"
I don't see other way to fix it. I probably miss something.
Here the function that permit the request
Here my package.json :
Here my app.json
Environment
Target
iOS device on Expo on React Native app
Expected Behavior
I would like the same output as the android emulator do.
Actual Behavior
My actual output is "Netword request failed"
The text was updated successfully, but these errors were encountered: