I’m having some problems with an API response. I’m developing an application for Android and iOS. When I call the get method to get some data, there are two scenarios: the first one, when there is data it returns to Json object with status 200 and all the information, and the second one, when there is not data and API returns and empty response with status 204. So, in my app, I evaluate the status, if the status is 200, it shows the data on the view for this section, and if the status is 204 I send an alert that says that there is not data. When I try that on my iOS emulator it works fine, but when I try the same functionality on an Android amulator or device, it just throw me an error.
This is my function:
This is the response when I try it on an iOS device:
This is the error I get when I try it on an iOS device:
What I expect it’s the status 204 to send a “no data” alert, but It seems it doesn’t works as in iOS devices.
I hope someone can help me.
Any way, Thanks a lot to read this. (: