Abhay
Abhay

Reputation: 3

React-native IOS [Network request Failed]

I'm new to react-native and I'm referring to "Learning React Native: Building Native Mobile Apps with JavaScript Book by Bonnie Eisenman".

while working on one of the examples I encountered "network request failed" error,Application builds successfully but I get this error when application try to fetch the data from the server.

I tried every solution that is present on stack overflow related to this question but none of them resolved my issue.

IOS version is 11.3 MacOS version is 10.13.4 Xcode version is 9

API code

enter image description here

info.plist

enter image description here

Error Image

enter image description here

Upvotes: 0

Views: 3004

Answers (1)

Prasun
Prasun

Reputation: 5023

As per your zipUrl function, the interpolation/template string is used wrongly, you need to use back-tick (`) not single quote ('). Take a look at the document here

Please try by changing the return statement to

zipUrl(zip) {
  return `...`;
}

Hope this will help!

Edit:

I was able to get data by changing http to https.

Upvotes: 1

Related Questions