Fetch doesn't work in React Native ios -


i have login function in react native try fetch data. function follows:

onlogin: function() {  //         const self = this;         self.setstate({modalvisible: true, modalmessage: 'signing in'});         fetch('http://psa.autralis.com/manager/api/v1/obtain-auth-token/', {             method: 'post',             headers: {                 'content-type': 'application/json',             },             body: json.stringify({                 username: self.state.username,                 password: self.state.password,             })         })             .then(response => response.json())             .then(data => console.log(data))             .catch((error) => {                 console.warn(error);             });     }, 

but reason doesn't work on ios. error :

enter image description here

on android works, , tested postman , there works.

any idea?

the reason problem that: ios not allow http requests default, https. if need http, change info.plist:

<key>nsapptransportsecurity</key> <dict>     <key>nsallowsarbitraryloads</key>     <true/> </dict> 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -