Issue
My code works fine when I fetch data from "http://www3.septa.org/beta/TransitView/23"
But while I try to fetch data from "http://localhost:3000/allDetails" I get an error in react-native saying:
"Network Request Failed".
I can get the data from "http://localhost:3000/allDetails" using Google Chrome but not when I fetch it in my react-native code.
I also tried to fetch data using "http://127.0.0.1:3000/allDetails" still same error.
Solution
I ran into this problem before. 127.0.0.1 will point to the emulator itself in your computer where the server is currently running. Try replacing 127.0.0.1 with 10.0.2.2 if you are on AVD or 10.0.3.2 if you are on Genymotion or with your computer's actual IP address.
Answered By - Mμ.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.