Real iOS device can't connect to backend

Hi there!

I just finished React Native part II - Offline support. Everything is working as expected on the iOS simulator.

I have an issue with my iOS device. When starting the App and loading the listings (the same process that simulator, where is working) I got the message “Couldn’t retrieve the listings”, and the result of the API call returns this:

Object {
“data”: Array [],
"error": true,
“loading”: false,
“request”: [Function request],
}

As you can see, the message is correct because, in fact, I couldn’t get the data from the backend (the one that Mosh provide us.)

Do you know why the real device can’t connect to the backend?

Thank you!

Notes:

  • Everything is connected to the same network.
  • In the device, everything that doesn’t connect to the backend works fine.

try creating an account in expo then go to the VS code terminal and type expo login then username, password… then restart everything including the expo app in your real device.

1 Like

Thank you very much!

I already fixed the problem, which was the API base client was pointing to localhost, I need to change to my machine IP address.

Thank you very much!

oh i had the same issues once.
im taking the react native course too. i finished the “notifcations” section. however do what i suggested above because you will need to do it when working with the notifications.

anyway, did you manage to go further with the app? im trying to expand the “Messages” section and make it to display the messages i send from the “Contact Seller” form, but im stuck and i dont have any idea how to do it.

did you try this or you are not trying to make more customizations to the app for now?

I wanted to fix my error just before starting notifications, which I believe I will start this weekend.

Right now I’m trying to load de images, I don’t seem to have more errors connecting to backend, but I need to make some changes… did you change the path of the assets in backend?

I’m planning to expand this project, which is a great base.